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

2 comments
Please use the Lua syntax for your code (it's the blue button).
In addition, please provide explanation with your code, what it does and how you want it to work.