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

how do i make the go into the players backpack for ever, even when they die?

game.Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(5410728) == 255 then 
   local tool = game.ServerStorage["TempleGuard"]:Clone() 
   tool.Parent = plr:WaitForChild("Backpack")
end
end)

this inserts the tool into there backpack fine, but I want it so that it will stay with you when you die.

I already tried changing

   tool.Parent = plr:WaitForChild("StarterPack")

but i got a warning about infinte yeild.

3 comments

0

You mean keep inventory?

0

kinda yeah

0

but except is for a specific rank in a group

1 answer

✓ Accepted answer

Try this:

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
local humanoid = chr:WaitForChild("Humanoid")
function addTool()
if plr:GetRankInGroup(5410728) == 255 then 
   local tool = game.ServerStorage["TempleGuard"]:Clone() 
   tool.Parent = plr:WaitForChild("Backpack")

end
end
humanoid.Died:Connect(function()
addTool()
end)
addTool()
end)
end)

Keep in mind this is not tested, and it might not work.

2 comments

0

when i tested it, my pc almost crashed. i got the tool, but i got so many copies of the tool it lagged my game it was like a loop or something, so i wouldnt know if it would come back if i reset

0

I edited it, sorry if it still doesn't work.

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