How to kill a player through a LocalScript

Im trying to fix an exit button in one of my old games by killing the player on the press, but it looks like I cant really kill a player through a localscript.I’ve tried putting the origin position to the area I want when the player exits, but its not working.
Could someone tell me how to kill a player through a local script, and make it possibly work a bit?

1 Like

If you mean another person, you can’t. However, if you mean the client, you could probably just do something like this:

local player = game.Players.LocalPlayer
player.Humanoid.Health -= math.huge
4 Likes
game.Players.LocalPlayer.Character.Humanoid.Health = 0

Using local script to reset the player’s character will make a bug in the server. They will see the player as alive but in client its dead. So use events.

8 Likes

The client has network ownership of their player so if they die, set their health to 0, etc it won’t bug the server as you put it.

3 Likes