Need help with my gui tween

i’m trying to tween my gui smoothly so that when i press play, a frame comes off the screen neatly. thanks.

my code:

script.Parent.MouseButton1Down:Connect(function()
	game.StarterGui.ScreenGui.Frame:TweenPosition(UDim2.new(-100,0,-100,0),Enum.EasingDirection.Out,Enum.EasingStyle.Linear,3,nil)
	wait(1)
	game.StarterGui.ScreenGui.Frame.Visible = false
		
end)

You must use PlayerGui:

local Player = game:GetService("Players").LocalPlayer
Frame = Player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame")

script.Parent.MouseButton1Down:Connect(function()
	Frame:TweenPosition(UDim2.new(-100,0,-100,0),Enum.EasingDirection.Out,Enum.EasingStyle.Linear,3,nil)
	wait(1)
	Frame.Visible = false
end)
1 Like

I would also use MouseButton1Click, if using a Click event.

1 Like