These are basic chat commands. The first function set is for the admin, the person listed. Problem is, it seems that any player can activate the admin commands. I included the public commands in case it is interfering.
game.Players.PlayerAdded:connect(function(player) --Admin if player.Name == "shiningwindow" or "Player1" then player.Chatted:connect(function(msg) if (msg == "genesis") then queue.Value = "Home By The Sea" end if (msg == "???") then queue.Value = "???" else if game.ServerStorage:FindFirstChild(msg) then queue.Value = msg end end end) end end) local easteractive = false game.Players.PlayerAdded:connect(function(player) --Easter Eggs player.Chatted:connect(function(msg2) if easteractive ~= true then --spam protection if (msg2 == "potato") then -- do stuff end end end) end)
Any help is greatly appreciated!
--In if statements, nil is considered false, --and all that exists (besides the bool "false") is considered true. if 1 then --A number is not nil. The following code will run. print("1 is considered true") end if "hey" then --A string is not nil. The following code will run. print("Strings considered true") end if workspace then --The workspace exists. The following code will run. print("The workspace is considered true") end if nil then --Nil is nil; it is the definition of non-existence. The following code will NOT run. print("Nil is considered true") end --Let's take a look at your code. game.Players.PlayerAdded:connect(function(player) if player.Name == "shiningwindow" or "Player1" then --Here's the problem. player.Chatted:connect(function(msg) if (msg == "genesis") then queue.Value = "Home By The Sea" end if (msg == "???") then queue.Value = "???" else if game.ServerStorage:FindFirstChild(msg) then queue.Value = msg end end end) end end) --"Player1" is a string, which is not nil/false, so the if statement must ALWAYS pass. Let's change that. game.Players.PlayerAdded:connect(function(player) if player.Name == "shiningwindow" or player.Name == "Player1" then --Only pass if the name is shiningwindow or Player1. player.Chatted:connect(function(msg) if (msg == "genesis") then queue.Value = "Home By The Sea" end if (msg == "???") then queue.Value = "???" else if game.ServerStorage:FindFirstChild(msg) then queue.Value = msg end end end) end end)
Your first if statement should be after the player.Chatted event. It starts listening for every player after you've joined, rather than checking if the player who chatted was you. If you want it to only listen to you, that if statement has to be inside the Chatted event.