Gamepass is not working

Hey, i am making gamepass that will give you a tool if you own it, but the problem is that it is not giving the tool.

here is the code i wrote:

local mp = game:GetService("MarketplaceService")
local id = -- my id is here
local tool = "HK33"

game.Players.PlayerAdded:Connect(function(plr)
       	plr.CharacterAdded:Connect(function(char)
		if mp:UserOwnsGamePassAsync(plr.UserId, id) then
			print("you're")
			script[tool]:Clone().Parent = plr.Backpack
		end
	end)
end)

Also it is not even printing anything in output

Any help will be very appreciated

1 Like

I don’t think you own the game pass just make a button wich will pop up so you can buy the gamepass if you want to test if that works.

when you make a game and I test it I don’t own the gamepass every time I join I need to buy it first.

i have bought it (30 30 30 30)

local MarketplaceService = game:GetService("MarketplaceService")
local Gamepass = 0

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(char)
		if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, Gamepass) then
			local Tool = script["Tool"]:Clone()
			Tool.Parent = Player.Backpack
		end
	end)
end)
1 Like

it actually worked, thank you so much!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.