So I have this code that is supposed to delete the message a player makes if it contains "hello", and then kick the player. But whenever I try to run it it doesn't get destroyed, here's the code:
local bad = "hello"
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg, recipient)
msg = msg:lower()
if msg.find(bad) then
msg:Destroy()
plr:Kick()
end
end)
end)
I have no idea why this is happening, any help is appreciated!

6 comments
can you try to print the msg? also is it a script or localscript? where is it located?
@CaioAlpaca i changed the name, i forgot to and its a serverscript in workspace
you can't destroy a string
idk what you are trying to do
The how would I go about destroying the message, not the string?
The how would I go about destroying the message, not the string?