--Having trouble with a kill script:
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.player.Torso:remove() end)
--(I want to kill the player by removing the torso and setting the players health to 0)
--Having trouble with a kill script:
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.player.Torso:remove() end)
--(I want to kill the player by removing the torso and setting the players health to 0)
So, you're understanding parameters, which is awesome.
"player" isn't the Player's name, but it's the actual Player
So instead of...
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.player.Torso:remove()
end)
You would first get the Player's name (player.name), then use :FindFirstChild() to find any object with that specific name.
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace:FindFirstChild(player.Name).Torso:Destroy()
end)
That should work, tell me if it doesn't!
script.Parent.ClickDetector.MouseClick:connect(function(player)
player.Torso:Destroy()
end)
Good Luck!
Another, more satisfying way to kill a player, is using player:BreakJoints(). It's also more resistant to bugs.
using anonymus functions to teach a new player is not a good idea, all it does is make your script more fancy and confusing to read, teach advanced people with it
I'm not using them to teach, he already knows them. This is the most stupid thing I've ever read.
yea, use destroy(). remove is depreciated/shouldn't be used anymore
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Ew