Still have questions? Join our Discord server and get real time help.
0

# How do i change the position of a Gui object smoothly?

Asked by 6 months ago

I know you have to use :TweenPosition or something but idk how to do it. Help?

0
._. thx mewant_taco 17 — 6mo

0
Miniller 364
6 months ago
Edited 6 months ago

Just an easy example for TweenPosition (local script at StarterCharacterScripts, but with RemoteEvents (in a Filtering Enabled game) can be in a normal script):

local player = game.Players.LocalPlayer
local clone = game.ReplicatedStorage.ScreenGui:Clone()
clone.Parent = player.PlayerGui
player.PlayerGui.ScreenGui.Frame:TweenPosition(UDim2.new(0.5, -50, 0.5, -50), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce)


line 04 is what you need, that's the example for TweenPosition.

EDIT: Point of this all is TweenPosition, and the link.

Hope this helps

1
Thx it helped a lot! mewant_taco 17 — 6mo
0
Answered by 6 months ago
Edited 6 months ago

If you want to smoothly move a GUI, use UDim2.new, if you want to modify the style of the movement, then visit this article on the different styles of movement -

https://developer.roblox.com/api-reference/enum/EasingStyle]

This has to be done in a Local Script, otherwise, the script will not play.

Here is how you could move a GUI, for example, using a TextButton to perform the task.

script.Parent.MouseButton1Click:Connect(function() -- When the text button is clicked.
print("Clicked") -- Just a message to tell you if it's working or not.
script.Parent:TweenPosition(UDim2.new(-0.15, 0, -5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quart) -- Visit the linked article in this post to see what style fits your preference best!

--[[ (Number xScale, Number xOffset, Number yScale, Number yOffset)) This is the number order within the parenthesis]]--

end)


If this is the answer to your question, please feel free to let me know! I hope this helps you!

0
I don't agree that this has to be in a LocalScript, as if someone using this in a FE server, with RemoteEvents, this should be in a normal script. Miniller 364 — 6mo