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

How to make a script that removes all items in the backpack on death?

Asked by 10 years ago

I'm making a game and i wan tall the guys when they died they loose there items in the backpack.

0
You shouldn't have to have a script for this, because I am pretty sure items get removed by default when a player dies. Would you happen to be referring to starterpack items? AwsomeSpongebob 350 — 10y
0
Yes starterpack items. masterhalo55 75 — 10y

2 answers

Log in to vote
2
Answered by 10 years ago

ClearAllChildren()

and

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            print(player.Name .. " has died!")
        end)
    end)
end)

0
Didn't work..... masterhalo55 75 — 10y
Ad
Log in to vote
0
Answered by
Kratos232 105
10 years ago

Hi. I made this script for you.

Script:

Players=Game:GetService("Players")

Players.PlayerAdded:connect(function(Player)
    Player.CharacterAddedd:connect(function(Character)

        Humanoid = Character:FindFirstChild("Humanoid")
        Backpack = Player:FindFirstChild("Backpack")

        Humanoid.Died:connect(function()
            Backpack:Destroy()
        end)
    end)
end)

I hope it works for you. Enjoy.

  • Kratos232

Answer this question