Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make my command slient?

So let me explain. On Kohl's Admin, you can do, well, commands. And the thing is. If you put a /e behind the whole command, it still works but it doesn't show up on chat. I want to figure out how to make my kill command be silent when you put a /e behind it

-- local gods = {"Loot_0"}
-- game.Players.PlayerAdded:Connect(function(plr)
-- plr.Chatted:Connect(function()
if string.sub(msg, 1, 6) == prefix.."kill " then -- If you typed "-kill " then
    for _, v in pairs(gods) 
        if plr.Name == v then -- If player is an admin, then
            for _, b in pairs(game.Players:GetPlayers()) do
	        local player = b.Name:lower() -- If you typed the name all lowercase, it will work. 
                if string.sub(msg, 7) == player then -- If you typed the player name then
	            workspace:FindFirstChild(b.Name).Humanoid.Health = 0 -- Kills the player
	             end
            end
	      end
       end
end
-- The ends might look weird, ignore that.

So here is my command. If you typed -kill loot_0 in chat, it would kill me! But how would I make it so that if I typed /e before the whole command, it wouldn't show up in the chat?

1 answer

✓ Accepted answer

Hello, Loot_0!

Anything you type on chat that isn't an roblox command triggers plr.Chatted so you just need to test for the /e

-- local gods = {"Loot_0"}
-- game.Players.PlayerAdded:Connect(function(plr)
-- plr.Chatted:Connect(function()
if string.sub(msg, 1, 6) == prefix.."kill "  or  string.sub(msg, 3, 9) == prefix.."kill " then -- If you typed "-kill " or "/e -kill"then
    for _, v in pairs(gods) 
        if plr.Name == v then -- If player is an admin, then
            for _, b in pairs(game.Players:GetPlayers()) do
            local player = b.Name:lower() -- If you typed the name all lowercase, it will work. 
                if string.sub(msg, 7) == player then -- If you typed the player name then
                workspace:FindFirstChild(b.Name).Humanoid.Health = 0 -- Kills the player
                 end
            end
          end
       end
end
-- The ends might look weird, ignore that.

Please comment if this don't works, I didn't tested the code

Good luck with your games

This discussion is preserved as it was. New answers, comments, and votes are closed.