Gamepass item giver not working

Hello!

I added pcall for security reasons, otherwise, this code definitely works. Try printing out hasGamePass value. Are you sure you own a gamepass? Is the gamepass ID correct? Make sure that the script (server script) is located in ServerScriptService (I accidentally put it inside ServerStorage at first :sweat_smile: ). Third party sales can be disabled and character is also already loaded by the time tool is copied.

local MarketPlaceService = game:GetService("MarketplaceService")

local GAMEPASS_ID = 15090522

-- correct path required
local tool = game:GetService("ServerStorage")["Golden Boom Box"]

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local hasGamePass; local success, err = pcall(function()
			hasGamePass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
		end)
		if (not success) then
			warn("Something went wrong while trying to access user's gamepass data.")
		end
		if (hasGamePass) then tool:Clone().Parent = player.Backpack end
	end)
end)
1 Like