How could i recreate this gui effect on the right side of the screen?

this is the effect im triying to do (this is just an example i only want the frame to slide out of the screen and the arrow stay)

this is what i got

the problem is that the arrow and the frame doesnt line up any help?
this is the code

local TweenService = game:GetService("TweenService")

local Tweeninfo = TweenInfo.new(0.5,Enum.EasingStyle.Sine, Enum.EasingDirection.Out)


local GUI = script.Parent

local Frame1 = GUI:WaitForChild("Frame")
local Button1 = GUI:WaitForChild("Close/Open")

local o = true
Button1.Activated:Connect(function()
	if o then
		o = false
		
		Frame1:TweenPosition(UDim2.new(1.2, 0,0.634, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,1)
		Button1:TweenPosition(UDim2.new(0.967, 0,0.522, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.5)
	else
		o = true
		Frame1:TweenPosition(UDim2.new(1, 0,0.634, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,1)
		Button1:TweenPosition(UDim2.new(0.84, 0,0.522, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.5)
	end
end)
1 Like

You seem to have the button and frame objects as completely separate in your GUI’s hierarchy when they should be together

Have the button be parented to the main GUI so that the button is guaranteed to slide with it flawlessly

Then you can omit having to call two Tween commands on two different GUI objects - with one parented to the other, you only need one command

Your code as it currently is works just fine - this issue is most easily solved by changing how the GUI objects are organized

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.