--Closes Gui function onChatted(message, player) if message == "/Close" then game.StarterGui.StatusGui.Status.Visible = false else game.StarterGui.StatusGui.Status.Visible = true end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)
I might have made an error somewhere but cant seem to find it. I used a similar script to kill the character but this one seems to not work. Is it not possible to use this method to close a Gui? What other options could be used?
You're using StarterGui
And so did everyone else, once upon a time
When you're changing something in StarterGui, the Player won't notice until they respawn. What you need to do instead is change it in the Player.PlayerGui
function onChatted(message, player) if message == "/Close" then player.PlayerGui.StatusGui.Status.Visible = false else player.PlayerGui.StatusGui.Status.Visible = true end end
As a side note, your else
block probably won't work how you want it to, because that will make it reappear if the Player says anything else.
You're changing the Gui of a Player, not the StarterGui because that would show up for everyone(it would not work anyway).
PlayerGui instead of StarterGui