Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Position of Frame never Changes?

Asked by 8 years ago
x = game.Workspace.Switch54.Value1.Value
y = game.Workspace.Switch54.Value2.Value
Frame = game.StarterGui.ScreenGui.Frame

while true do
    wait()
    Frame.Position = UDim2.new(0,x,0,y)
end

Output says nothing but Frame doesnt move.

Thanks for help.

1 answer

Log in to vote
0
Answered by 8 years ago

It doesn't move because the x and y variables are static. Basically they're not going to change because they were only called once at the beginning of the script.

If you want to fix that, simply move the x and y variables into the while true do loop and it will update whenever the loop runs, like so:

local Frame = game.StarterGui.ScreenGui.Frame

while true do
    wait()
    local x = game.Workspace.Switch54.Value1.Value
    local y = game.Workspace.Switch54.Value2.Value
    Frame.Position = UDim2.new(0,x,0,y)
end

Hope this helped!

Ad

Answer this question