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

What is wrong with my piece of coding?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

Im trying to make it to where when someone says "nil me" there player gets removed I am editing the Become Anybody Script ( Hopefully everyone is aware of what that script is )

so here is my code.

function onChatted(msg, recipient, speaker)
    local source = string.lower(speaker.Name)

    if (string.sub(msg,1,4) == "nil me") then
        speaker.remove()
    end
end
game.Players.ChildAdded:connect(onPlayerEntered)

any answers and Possibly explanations on why this is wrong would be helpful.

2 answers

Log in to vote
0
Answered by
Mr1Vgy 30
10 years ago

Well the main problem I see is that it should be :remove() not .remove(). Otherwise I don't really see any problems.

Ad
Log in to vote
0
Answered by 10 years ago

That isn't the primary problem, but it is one.

game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
if (msg:sub(1,4) == "nil ") then
if (msg:sub(5) == "me") then
plr.Parent = nil;
else 
targ = game.Players[msg:sub(5)];
targ.Parent = nil;
end
end
end)
end)

Answer this question