localscript - for GUI
local function gameLoop(player)
if playing == true then
local obstacle = Instance.new("ImageLabel")
obstacle.Image = "rbxassetid://104767996247335"
local randomNumber = math.random()
obstacle.Name = "Obstacle"
obstacle.Size = UDim2.fromScale(0.2, 0.3)
obstacle.Position = UDim2.fromScale(1, randomNumber)
obstacle.BackgroundTransparency = 1
obstacle.ZIndex = 2
local obstacleMove = TweenService:Create(obstacle, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Position = UDim2.fromScale(-0.3, randomNumber)})
obstacle.Parent = kittyBounce.Game
while not obstacle.IsLoaded do --Should wait til the image has finished loading in.
task.wait()
end
obstacleMove:Play()
task.wait(0.525)
i'm making a GUI arcade game - basically every second an obstacle should pass from right to left across the screen but the image takes a second to load making the obstacle load up half way across the screen sometimes giving you no time to dodge it but the game never starts when i try waiting for the IsLoaded variable.