I was trying to make a script so that when a textbutton is clicked, the gui would move. It doesn’t move when I click it for some reason, and there aren’t any errors. Here is the script:
local xPos = math.random(.01, .95)
local yPos = math.random(.01, .95)
while wait(.05) do
xPos = math.random(.01, .95)
yPos = math.random(.01, .95)
end
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Position = UDim2.fromScale(xPos, yPos)
end)
I also tried using script.Parent.Position = UDim2.new(xPos, 0, 0, yPos) , and still nothing.
Script type: LocalScript
Parent: TextButton
Parent of TextButton: Frame
Parent of Frame: ScreenGUI
Parent of ScreenGUI: StarterGUI
If you have any questions, feel free to ask! Thanks!
You have to tween position it. So detect when the text button is clicked then tween position the text button to the coordinates you want and you can also add effects to it as well like a bouncy effect. With your case you could do this.
It’s because you have to put your own Enum.EasingDirection and Enum.EasingStyle after you write those put another . and choose which one. It should automatically pop up