this works in the way that the player gets the item and when he/she resets/dies they will get it in there inventory and what doesn't work is that other players when they die the item stays in server storage and its a problem when it leaves the inventory, in general, how would I fix this thank you
local gamepassid_ = 10022825 local b = game:GetService("ServerStorage"):FindFirstChild("GravityCoil"):Clone() game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10022825) then if player.Backpack:FindFirstChild("GravityCoil") == nil then game.ServerStorage:FindFirstChild("GravityCoil"):Clone() b.Parent = player.Backpack end end end) game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() b:clone() game:GetService("ServerStorage"):FindFirstChild("Gravitycoil"):clone() wait(5.2) print(gamepassid_) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10022825) then if player.Backpack:FindFirstChild("GravityCoil") == nil then game.ServerStorage:FindFirstChild("GravityCoil"):Clone() b.Parent = player.Backpack end end end) end) end)
Players have a .StarterGear which holds items that they spawn with. So you could do;
local gamepassid_ = 10022825 local b = game:GetService("ServerStorage"):FindFirstChild("GravityCoil"):Clone() game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10022825) then if player.Backpack:FindFirstChild("GravityCoil") == nil then game.ServerStorage:FindFirstChild("GravityCoil"):Clone().Parent = player.StarterGear --Adds it to their startergear b.Parent = player.Backpack end end end)