Gamepass not giving my friend the items

So I have recently made a gamepass for one of my games, and it gives me the items when i test it. However, when my friend bought it, he didn’t receive any items. It says he owns it, and the transaction is in my transactions tab. I have a bit around the devforum, and not much was found.

Here is the code I used:

local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassID = 761626951
local ToolName1 = "Briefcase"
local ToolName2 = "Silenced Pistol"
local ToolName3 = "Walkie Talkie"

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, 257747776) then
			script[ToolName1]:Clone().Parent = player.Backpack
			script[ToolName2]:Clone().Parent = player.Backpack
			script[ToolName3]:Clone().Parent = player.Backpack
		end
	end)
end)

Another gamepass that uses the same type of code I have seems to work fine, as others have bought and received their items from that gamepass.
I’m relatively new to coding, so could just be a mistake. If not, then it might be a roblox related issue. Help will be greatly appreciated.

Which one is your gamepass ID?

1 Like

You have a GamepassID variable stored, but you are using a different ID entirely in the UserOwnsGamepassAsync. Replace 257747776 with GamepassID

2 Likes

oh. I just noticed that. my bad, let me fix this and I will test it.

1 Like

Sorry about that, I fixed it and it works now.