Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Position of Frame never Changes?

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

✓ Accepted answer

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.