Forum > Coding >

Kill Local Player?

Posts: 196

Threads: 58

Joined: Apr, 2020

Reputation: 3

Posted

How would I kill the local player after they have done a certain task for example walk/float/fly a few studs or after picking something up like cash?
I tried fining out but they didn't really kill the player.

 

 

-- for example

if player.leaderstats.Cash.Value > 3 then
    player.Character.Humanoid.Health = 0
end

 

I tried doing that but it didn't work.

Is there a better way to do this or am I doing something wrong?
I just want the player to reset after doing a certain task is that even possible?

 

I was also thinking maybe this could work but it didn't. Maybe I'm doing something wrong.

If you can help can you tell me how you did it instead of just spoon feeding me the information?

if player.leaderstats.Cash.Value > 3 then
    game.Workspace.player.Head:Destroy() --I'm going to replace .player with my username
end

 

 

  • 0

tar

CoolNickname

Posts: 119

Threads: 11

Joined: Jul, 2021

Reputation: 1

Replied

Multiple ways:

Break joints of head (head:BreakJoints())

Destroy Humanoid (Does not kills but causes player to respawn)

Teleport to very down (like Y -999)

 

  • 2

https://imgur.com/a/oOomuUo

Posts: 7

Threads: 3

Joined: Sep, 2020

Reputation: 0

Replied

local player = game.Players.LocalPlayer -- Gets the local player
if player.leaderstats.Cash.Changed:Connect(function(newvalue)
    if newvalue > 3 then
        player.Character.Head:Destroy() -- Gets the players character and destroys the head
    end
end)
  • 2

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )