So I have a gamepass that gives a tool when she/he buys it but when the player dies the tool disappear from the backback/inventory
so can someone help me on how to add a feature that still keeps the tool even after dying, I dont know where to start to make this feature so if somebody can help me i will appreciate it…
Where is the tool parented? You can use Humanoid.Died to detect when they die and clone all the tools from their backpack back into them.
something like this maybe
game.Players.PlayerAdded:Connect(function(player)
local backpack = player:WaitForChild("Backpack")
local character = player.Character or player.CharactedAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
local tools = {}
for index, tool in pairs(backpack:GetChildren()) do
if tool:IsA("Tool") then
-- parent the tool where ever it is
end
end
end)
end)
after they bought the gamepass i just cloned the tool to the character I dont know if that will put it on StarterGear as Im still new to scripting but i will change the clone parent to Startergear so thank you
Don’t just change the parent to StarterGear as that will only give the tool after respawns, make 2 clones and put one in their Backpack and one in their StarterGear