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

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

Asked by 5 years ago

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)
0
just add it to the starter gear theking48989987 2147 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)

Ad
Log in to vote
0
Answered by
BRAEGON -8
5 years ago

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

Answer this question