Need help with gamepasses

You can write your topic however you want, but you need to answer these questions:

  1. What is the issue? Include enough details if possible!
    Currently I have three gamepasses (x2, Pair Of Wings, Shield) and they work. However, when I / someone who owns these gamepasses, people who don’t own it can equip the hammers.

  2. What solutions have you thought of so far?
    I have asked ChatGPT for help, using local scripts for the gamepass handler, used remote events to fire an event to the client to enable proximity prompts

game.Players.PlayerAdded:Connect(function(plr)
	local hamgp = workspace:WaitForChild("GPHAMMER")
	local gpservice = game:GetService("MarketplaceService")
	local x2 = 911281044
	local shield = 911747545
	local wings = 911355175
	
	
	if gpservice:UserOwnsGamePassAsync(plr.UserId, wings) then

		hamgp:WaitForChild("PAW").Wings.Handle.Purchase.Enabled = false
		hamgp:WaitForChild("PAW").Wings.Handle.ProximityPrompt.Enabled = true
	else
		hamgp:WaitForChild("PAW").Wings.Handle.Purchase.Enabled = true

		hamgp:WaitForChild("PAW").Wings.Handle.Purchase.Triggered:Connect(function(plya)
			gpservice:PromptGamePassPurchase(plya, wings)
		end)
	end
	
	if gpservice:UserOwnsGamePassAsync(plr.UserId, shield) then
		
		hamgp:WaitForChild("Shield").Hammer.Handle.Purchase.Enabled = false
		hamgp:WaitForChild("Shield").Hammer.Handle.ProximityPrompt.Enabled = true
	else
		hamgp:WaitForChild("Shield").Hammer.Handle.Purchase.Enabled = true
		
		hamgp:WaitForChild("Shield").Hammer.Handle.Purchase.Triggered:Connect(function(plya)
			gpservice:PromptGamePassPurchase(plya, shield)
		end)
		
		
	end
	if gpservice:UserOwnsGamePassAsync(plr.UserId, x2) then
		local equip = workspace:WaitForChild("GPHAMMER"):WaitForChild("x2 gamepass").Union.ProximityPrompt
		local owned = true
		hamgp:WaitForChild("x2 gamepass").Union.ProximityPrompt.Enabled = false
		script.Parent:WaitForChild("Script"):SetAttribute("X2", true)
	else
		hamgp:WaitForChild("x2 gamepass").Union.ProximityPrompt.Enabled = true

		hamgp:WaitForChild("x2 gamepass").Union.ProximityPrompt.Triggered:Connect(function(plya)
			gpservice:PromptGamePassPurchase(plya, x2)
		end)
	
	end



		
	end)

Yes, I know i am using a server script so basically if its enabled or disabled for one its actually like that for all. I just don’t know where to start to fix this issue

Instead of checking if the player owns your gamepasses when they join, why not check whenever they activate the proximity prompt? You can keep the proximity prompts enabled for everyone but handle giving them the tool or prompting purchase for when the prompt is triggered

2 Likes

thank you i’'m going to try it

thank you so much it works now

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