Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

msg cannot be destroyed, what?

Asked by 3 years ago
Edited 3 years ago

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!

0
can you try to print the msg? also is it a script or localscript? where is it located? CaioAlpaca 342 — 3y
0
@CaioAlpaca i changed the name, i forgot to and its a serverscript in workspace WideSteal321 773 — 3y
0
you can't destroy a string AnasBahauddin1978 715 — 3y
0
idk what you are trying to do AnasBahauddin1978 715 — 3y
View all comments (2 more)
0
The how would I go about destroying the message, not the string? WideSteal321 773 — 3y
0
The how would I go about destroying the message, not the string? WideSteal321 773 — 3y

Answer this question