I am trying for the first time (for me) to make an intro gui w/ a moving button but i'm being stupid and not making it work. Please look at my code and tell me how to make it not run into some weird loop or whatever it is doing to shut down my roblox studio.
Gui = {script.Parent.Frame, script.Parent.ButtonBack, script.Parent.TextButton, script.Parent.TextLabel, script.Parent} Frame = Gui[1] ButtonBack = Gui[2] TextButton = Gui[3] TextLabel = Gui[4] Parent = Gui[5] TextButton.MouseButton1Down:connect(function() if TextButton.Position == UDim2.new(0, 860, 0, 445) then print(TextButton.Position) while TextButton.Position ~= ButtonBack.Position do TextButton.Position = TextButton.Position+UDim2.new(0, 0, 0, 0.1) end end end)
at line 9 i'm referring to what the position is/should be at the start.
I think your problem would be line 9. If you tried print(TextButton.Position)
The UDim2 wouldn't be there, just four numbers with {} brackets. So maybe:
Gui = {script.Parent.Frame, script.Parent.ButtonBack, script.Parent.TextButton, script.Parent.TextLabel, script.Parent} Frame = Gui[1] ButtonBack = Gui[2] TextButton = Gui[3] TextLabel = Gui[4] Parent = Gui[5] TextButton.MouseButton1Down:connect(function() if tostring(TextButton.Position) == "{0, 860}, {0, 445}" then print(TextButton.Position) while TextButton.Position ~= ButtonBack.Position do TextButton.Position = TextButton.Position+UDim2.new(0, 0, 0, 0.1) end end end)
would work? Either way, I wouldn't recommend doing it like this. Roblox has built in methods for tweening, you should check those out.