Tool is Gone After Death/Reset

Alright, so let’s get straight to the point.
I have a script in ServerScriptService which gives a player a specific tool depending on the amount of Strength they have once they join the game. Here’s an example:

if strength.Value >= 50 and strength.Value < 120 then
   game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.Backpack
end

This is one script that I used for giving the player the other types of tools. It works fine, but once you are killed, or if you reset, your tool is gone. Is there a way I can make it so that the tool stays in your inventory? If not, is there another way for this script above to run again even after you’ve gotten killed?

Additional Information:

I have a folder (named “HeadsTools”) in ReplicatedStorage which stores the many tools in my game.

6 Likes

Store it in StarterGear so they can keep it even after they die.

3 Likes

Connect a function to an event when that player dies to run the script again.

Humanoid.Died:Connect(function()
   if strength.Value >= 50 and strength.Value < 120 then
   game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.Backpack
end
end)

1 Like

thats unnecessary, as all you have to do is add game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.StarterGear after game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.Backpack, this makes it to where the tool will be there if you die/respawn. this is what it would look like,

if strength.Value >= 50 and strength.Value < 120 then
   game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.Backpack
game.ReplicatedStorage.HeadsTools.DroolingJohnsen:Clone().Parent = player.StarterGear

end
5 Likes

The more options the merrier. Would you happen to disagree?

1 Like

He just means no need to reinvent the wheel.

I would happen to disagree because the Died event runs for the current character. Backpack and PlayerGui are cleared out when the character respawns, the latter given exception if you use the escaping property ResetOnSpawn. This effectively makes this useless.

If you want to have success with restoration of a tool after death, then your system should be designed to distribute a tool or modify one after the player dies. StarterGear is also an option to work with if it fits well in your system. Ask me personally and I’d say I prefer to handle respawn cases myself.