I need someone to explain how to used a UDim2 or how to move a GUI?
UDim2.new
is for moving GUI.
for use it you need to said wich frame you'll move or size.UDim2.new use fourth value one for the Position of X for the Scale, the second is for the X too but for the Offset, the third is for the Y Scale and finally the fourth is for the Y but for the Offset -->(XScale, XOffset, YScale, YOffset).
If you want know more about UDim2.new you can go on Roblox wiki here Exemple here:
local screenGui = Instance.new("ScreenGui", script.Parent)--script.Parent mean in the PlayerGui local frame = Instance.new("Frame", screenGui) frame.Size = UDim2.new(0, 10, 0, 10)--(XScale, XOffset, YScale, YOffset) frame.Position = UDim2.new(0, 100, 0, 200)--(XScale, XOffset, YScale, YOffset)
Don't forgot to put this script in the StaterGui if you take this code
Adding onto Toon's answer, if you want it to move/slide to a position use TweenPosition!
You need to get the basic idea on how UDim2 works. After you use the TweenPosition method you need to call some arguments.
UDim2
value for this.nil
and that it's a function that returns a void
.local gui = script.Parent.Frame.TweenGui gui:TweenPosition(UDim2.new(0,50,0,400), "Out", "Back", 5, false, nil) --Moves gui to 0,50,400 in 5 seconds
Hope it helps!