I have the script set to give an item as long as they have the gamepass, but after the player dies, the item no longer gets into the player's inventory. Can someone help?
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:wait() if game:GetService("GamePassService"):PlayerHasPass(player, --------) then game.ReplicatedStorage:FindFirstChild("Weapon3"):Clone().Parent = player.Backpack game.ReplicatedStorage:FindFirstChild("Weapon3"):Clone().Parent = player.Backpack end end)
The code you have will only run once as you do not connect a CharacterAdded event which fiires when the character spawns / respawns.
Connecting the event will resolve this problem,e.g:-
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:Connect(function(charModel) -- wait for backpack as it may take a small mount of time to be created when the player joins the game player:WaitForChild('Backpack') if game:GetService("GamePassService"):PlayerHasPass(player, --------) then game.ReplicatedStorage:FindFirstChild("Weapon3"):Clone().Parent = player.Backpack game.ReplicatedStorage:FindFirstChild("Weapon3"):Clone().Parent = player.Backpack end end end)
I hope this helps