I’m not sure why the gui isn’t disappearing, when the visible/enabled turns off:
here is the script:
I’m not sure why the gui isn’t disappearing, when the visible/enabled turns off:
here is the script:
Server Script: Changes will not be made to the client
Change it to a LocalScript
instead if you want to change the Visible
property on the client
You’re toggling from StarterGui, that location is where guis are replicated to the Players’s PlayerGui.
Touched
returns the part that touched something, so you can use that to get the player, also you can use the not
operator to invert
local Players = game:GetService("Players")
local gamesLibrary = workspace.GameLibrary.Circle.Cricle
gamesLibrary.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then
return
end
local playerGui = player.PlayerGui
local libraryScreen = playerGui.GamesLibraryScreen
libraryScreen.Enabled = not libraryScreen.Enabled
libraryScreen.Frame.Visible = not libraryScreen.Frame.Visible
end)
Keep in mind that if the thing is closed on the client, the server still sees it as the former state, I recommend you put this in a localscript in StarterPlayerScripts and add some verification to who touched other else it’ll change the Enabled and Visible for everyone