game.Workspace.Values.Guns.Changed:connect(function(g) if g == "Give" then local Player = game:GetService("Players").LocalPlayer local Item = game:GetService("ReplicatedStorage").Guns.Pistol:Clone() Item.Parent = Player.Backpack end end)
I am trying to make something that gives a play a gun in their BackPack, but when they die they lose that item. Do I have to make something that detects if a player has died and if so restockthem with the item, or can I have something which even if the player dies, they keep the weapon?
I am not a noob to scripting, I have knowledge of it. I am not requesting any coding, just asking if it is possible, and maybe somethings I would need to add to the script.
When giving the item to the player, make a clone for both the Backpack and the StarterGear.
game.Workspace.Values.Guns.Changed:connect(function(g) if g == "Give" then local Item = game:GetService("ReplicatedStorage").Guns.Pistol Item:Clone().Parent = game.Players.LocalPlayer.Backpack Item:Clone().Parent = game.Players.LocalPlayer.StarterGear end end) -- WARNING - Changed Event isn't reliable at times
-Goulstem