So technically I am trying to close a gui with a local script. But where the I have a problem is that, yes you can "Close it" after you reset, but I need it when they click the "X" button. So thats when accessing the player who clicked the gui comes in handy.
local frame = game.Players..PlayerGui.Starter.ScrollingFrame--Not sure how to find the player who clicked @ Players..PlayerGui? function closed() frame.Visible = false print("Whats New/ Closed") end script.Parent.MouseButton1Down:connect(closed)
Being a local script, this should be embedded in the player, meaning: EX: local plr = script.Parent.Parent.Parent (however many you need until you reach the Parent of PlayerGui) will get you the player that you want, Is that the answer you were looking for?
There is actually a read-only property of Players that can only be accessed from a local script called LocalPlayer.
You can use it in your script as so:
local player = game.Players.LocalPlayer local frame = player.PlayerGui.Starter.ScrollingFrame function closed() frame.Visible = false print("What's new/ Closed") end script.Parent.MouseButton1Down:connect(closed)