Gamepass Item duplicates every time you join a game

I’m not sure how am I going to fix this

Script:

local MS = game:GetService("MarketplaceService")
local P = game:GetService("Players")

local Tool = script.Tool
local GamepassID = script.GamepassID

P.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if MS:UserOwnsGamePassAsync(Player.UserId,GamepassID.Value) == true then
			local NewTool = Tool.Value:Clone()
			NewTool.Parent = Player.Backpack
		end
	end)
end)

Update: There is nothing wrong with my ToolSave script

Check if they already have tool in their backpack or if it’s saved, don’t give them tool again if they already own tool

1 Like

yes but how do you do it? i really don’t know lol

Add a debounce so it only does this once.

Are you using a local script? That might be the problem.

Nope I am using a script… I really do not know the problem whether my gamepass script keeps giving the player the tool or the toolsave script keeps duplicating the same tool…

It does not work… While testing this I found out that there is nothing wrong with my ToolSave script meaning the problem is on the Gamepass Script but anyways thanks…

if not player.Backpack:FindFirstChild("ToolName") then --no tool in their backback
 --give tool
  local NewTool = Tool.Value:Clone()
  NewTool.Parent = Player.Backpack
end
1 Like

Thanks, man now I am going to find a way to convince the players who bought my gamepass to drop their duplicated items