This is a simple problem, i’m trying to animate a Billboard Gui so it goes goes up and down, however, the Y Coordinate never changes, what causes this?
Here is the code:
--Variables
local Player = game:GetService("Players").LocalPlayer
local CheckPointNumber = Player:WaitForChild("CheckPointNumber")
local CheckPointFolder = game.Workspace:WaitForChild("_CheckPoints")
local BillBoard = script.Parent:WaitForChild("NextStage")
local function OnLevel() -- Ignore this pl0x
BillBoard.Adornee = CheckPointFolder:FindFirstChild(tostring(CheckPointNumber.Value + 1))
end
CheckPointNumber.Changed:Connect(OnLevel)
function Down() --Go down
BillBoard.ExtentsOffsetWorldSpace = Vector3.new(BillBoard.ExtentsOffsetWorldSpace.X, BillBoard.ExtentsOffsetWorldSpace.Y - 1, BillBoard.ExtentsOffsetWorldSpace.Z)
if BillBoard.ExtentsOffsetWorldSpace.Y <= 90 then
BillBoard.ExtentsOffsetWorldSpace = Vector3.new(BillBoard.ExtentsOffsetWorldSpace.X, 90, BillBoard.ExtentsOffsetWorldSpace.Z)
Up()
end
if BillBoard.ExtentsOffsetWorldSpace.Y > 90 then
delay(1/60, function() Up() end)
end
end
function Up() -- go up
BillBoard.ExtentsOffsetWorldSpace = Vector3.new(BillBoard.ExtentsOffsetWorldSpace.X, BillBoard.ExtentsOffsetWorldSpace.Y + 1, BillBoard.ExtentsOffsetWorldSpace.Z)
if BillBoard.ExtentsOffsetWorldSpace.Y >= 100 then
BillBoard.ExtentsOffsetWorldSpace = Vector3.new(BillBoard.ExtentsOffsetWorldSpace.X, 100, BillBoard.ExtentsOffsetWorldSpace.Z)
Down()
end
if BillBoard.ExtentsOffsetWorldSpace.Y < 100 then
delay(1/60, function() Down() end)
end
end
OnLevel() --Ignore this pl0x
Down() --Start the animation
Keep in mind that this code also does some other functions, so i marked them as “ignore this pl0x” so it’s easier to track what part of the code is failling.
Any help is appreciated, thanks!