Hey i copied this script from roblox's game pass page and changed staff a bit BUT for some reason it dosent work


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamePassID = 116054185 -- Change this to your game pass ID
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local function onPlayerAdded(player)
	local hasPass = false
	-- Check if the player already owns the game pass
	local success, message = pcall(function()
		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
	end)
	-- If there's an error, issue a warning and exit the function
	if not success then
		warn("Error while checking if player has pass: " .. tostring(message))
		return
	end
	if hasPass then
		character.Gold.Handle.Transparency = 0
		character.Gold.Handle.ParticleEmitter.Enabled = true
	end
end
-- Connect "PlayerAdded" events to the "onPlayerAdded()" function
Players.PlayerAdded:Connect(onPlayerAdded)