Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is wrong with my piece of coding?

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.