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

How do you get a tool to stay in your inventory on death?

Well, I have an equip button for each tool. But when you equip the tool you get it but when you die you have to equip it again. So how do you get it to stay equipped even on death? The Button Script:

local equipped = script.Parent.Parent.Parent.Handler.Equipped
local selected = script.Parent.Parent.Parent.Handler.Selected
local location = script.Parent.Parent.Parent.Handler.Location
local player = game.Players.LocalPlayer
local character = player.Character

script.Parent.MouseButton1Click:connect(function()
	if equipped.Value == nil or equipped.Value ~= selected.Value then 
		character.Humanoid:UnequipTools() 
		if location.Value == player.Backpack then
			character.Humanoid:EquipTool(selected.Value)
			equipped.Value = selected.Value
			script.Parent.Text = "Unequip"
		end
	else
		character.Humanoid:UnequipTools()
		equipped.Value = nil
		script.Parent.Text = "Equip"
	end
end)

1 comment

0

just add it to the starter gear

2 answers

I do not know how to do that. But maybe you can actually re-equip the item automatically after the player is revived.

If you do not want to do so (which you definitely are), maybe you can delete the player's Backpack CoreGUI, and make your won inventory system. (Thanks to this post for notifying me: https://devforum.roblox.com/t/help-in-inventory-system/233992/4)

you could just reinsert it into the player on death, you could check this by using a localscript to see if the players health was 0 or bellow 0

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