Help with TweenPosition

Hi! I’m pretty new to scripting and I made a GUI open with tweeningposition, but I also added so you can close it with a button. But the close GUI function won’t work.

Here’s the code:

1 Like

Also, opening the GUI works but not when closing.

1 Like

You use PlayerGui, not StarterGui.
StarterGui is what is getting sent to the Player on join,
PlayerGui is what the Player get’s, and see’s .

to do this, you would use the LocalPlayer:

local Player = game.Players.LocalPlayer -- Player the LocalScript is running for

Note that this doesnt work on the Server as the Server doesnt know who the Player is, only LocalScripts, so to Access PlayerGui, It’s as simple as this:

local PlayerGui = Player.PlayerGui -- Basically StarterGui put into the Player
2 Likes

Oh okay! I will try changing it to playergui now.

It worked! Thank you so much for helping. :slight_smile:

1 Like

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