So I have a script where if you say mainmenu/on, or off, it will make the mainmenu pop up. Well for some reason when I tested it I said "mainmenu/on", it worked, but when I tried mainmenu/off, it did not go away. Can someone fix this? Here's the script, if you could please?
local function onChatted(msg, recipient, speaker)
local msg = msg:lower()
if msg == "mainmenu/on" then
if not speaker.PlayerGui["ScreenGui"].Frame.Visible == true then
speaker.PlayerGui["ScreenGui"].Frame.Visible = true
elseif msg == "mainmenu/off" then
if not speaker.PlayerGui["ScreenGui"].Frame.Visible == false then
speaker.PlayerGui["ScreenGui"].Frame.Visible = false
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
