Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

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?

0

Yes starterpack items.

2 answers

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)

1 comment

0

Didn't work.....

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

This discussion is preserved as it was. New answers, comments, and votes are closed.