so i wanted to make a script that kills the chatter whenever he or she said a specific thing if they were a specific person say for example, Player 1 said pwnt then player 2 said pwnt, then player 3 but then only player 1 would get killed because he was a specific person who chatted something very specific but it wont work, at least not properly.
function onChatted(msg, speaker) local source = string.lower(speaker.Name) local msg = string.lower(msg) local playr = game.Players.LocalPlayer local ad = playr:GetFullName() if msg == "get rekt" then if ad == "Player1, Player2, Player 3" then speaker.Character.Head:remove() -- end end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end) end game.Players.ChildAdded:connect(onPlayerEntered) function onChatted(msg, speaker) end
This is a local script in StarterGui
function onChatted(msg, speaker) local source = string.lower(speaker.Name) local msg = string.lower(msg) local player = game.Players.LocalPlayer local ad = player:GetFullName() if msg == "get rekt" then if ad == "Player1" then --you only need to put player1 speaker.Character.Head:remove() -- end end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end) end game.Players.ChildAdded:connect(onPlayerEntered) function onChatted(msg, speaker) end
This should fix it!