I want to make a tool stay in the player’s backpack after death, and the item is given when that player clicks on a model of that tool, for it to be added to their backpack from ServerStorage.
The issue is that if a player dies, it disappears from their inventory, and you can’t click it again to get it back since an error comes, saying that the parent is locked, though the locked parent is backpack.
I searched for solutions on the web and the devforum, but I couldn’t find any for my exact problem.
Current script:
local serverStorage = game.ServerStorage
local storedKeycard = serverStorage.Keycard
local keycard = storedKeycard:Clone()
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if keycard.Parent ~= player.Backpack then
keycard.Parent = player.Backpack
end
end)
Just saying, I am not an experienced scripter so I have no idea on how to do this.