gui = game:GetService("StarterGui") script.Parent.MouseClick:Connect(function() gui.ScreenGui.Frame:TweenPosition(UDim2.new(0, 0, 0, 0),'In','Quad',1) end)
This is a LocalScript, and I'm wondering what is wrong. Am I missing something?
What Vezious said is valid that you have to use player gui instead of starter gui but you also forget that the easing direction and the easing style are enum values, not strings. therefore, the correct local script code should be similar to:
local Player = game.Players.LocalPlayer local Gui = Player.PlayerGui:FindFirstChild("ScreenGui") script.Parent.MouseClick:Connect(function() Gui.Frame:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,1) end)
also, as you have this in a mouse click,if you want to make it open and close, I also encourage the setting of the override variable to true as if a player clicks the button again before the tween finishes playing, it doesn't seem "glitchy"
local open = false local Player = game.Players.LocalPlayer local Gui = Player.PlayerGui:FindFirstChild("ScreenGui") script.Parent.MouseClick:Connect(function() if not open then Gui.Frame:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,1,true) open = true else --tween to closed position open = false end end)
The problem is that you're Tweening the StarterGui one.
You need to get the player's clone of the GUI. It's found under Player.PlayerGui.
Therefore, your script should look like this:
local Player = game.Players.LocalPlayer local Gui = Player.PlayerGui:FindFirstChild("ScreenGui") script.Parent.MouseClick:Connect(function() Gui.Frame:TweenPosition(UDim2.new(0,0,0,0),"In","Quad",1) end)