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 11 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 — 11y
0
Yes starterpack items. masterhalo55 75 — 11y

2 answers

Log in to vote
2
Answered by 11 years ago

ClearAllChildren()

and

1game:GetService('Players').PlayerAdded:connect(function(player)
2    player.CharacterAdded:connect(function(character)
3        character:WaitForChild("Humanoid").Died:connect(function()
4            print(player.Name .. " has died!")
5        end)
6    end)
7end)

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

Hi. I made this script for you.

Script:

01Players=Game:GetService("Players")
02 
03Players.PlayerAdded:connect(function(Player)
04    Player.CharacterAddedd:connect(function(Character)
05 
06        Humanoid = Character:FindFirstChild("Humanoid")
07        Backpack = Player:FindFirstChild("Backpack")
08 
09        Humanoid.Died:connect(function()
10            Backpack:Destroy()
11        end)
12    end)
13end)

I hope it works for you. Enjoy.

  • Kratos232

Answer this question