Gamepasse problem

GAMEPASSES ISSUE

Greetings Boys and Girls,

I am currently making a game beside a friend, and I am having some issues with making gamepasses. I have watched a vast amount of videos and they never seem to work.

MY ISSUE

The problem I am having, is when people buy the gamepass it automatically implants it into their tool bar and have it everytime they join the game.

If I cannot solve this, it will mean an Admin will have to join the game and manually give it to them. Also, I would be called a scammer.

If you can help, please DM me on Discord ASAP seal#8815

I need a tutorial on how to do the script, please make sure you are informative and not lazy guide me through it.

SCRIPTS

NORMAL SCRIPT
local MarketPlaceService = game:GetService(ā€œMarketplaceServiceā€)

    local GamepassId = 1234567 -- REPLACE 1234567 WITH YOUR GAMEPASS ID
    local Tool = script.DesertEagle -- REPLACE GravityCoil WITH THE NAME OF YOUR TOOL

    game.Players.PlayerAdded:Connect(function(Player)
    	Player.CharacterAdded:Connect(function(Character)
    		if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
    			local ToolClone = Tool:Clone()
    			ToolClone.Parent = Player.Backpack
    		end
    	end)
    end)

**LOCAL SCRIPT**

    local Marketplace = game:GetService("MarketplaceService")

    local MainFrame = script.Parent.MainFrame
    local DesertEagleGamepass = MainFrame.GamepassMainFrame.SwordGamepass
    local OpenShop = MainFrame.Parent.OpenShop

    local player = game.Players.LocalPlayer

    local deserteagleGamepassID = 20360180
    	
    	DesertEagleGamepass.MouseButton1Down:Connect (function()
    	local success, message = pcall(function()
    		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, DesertEagleGamepassID)
    	end)
    	
    	if hasPass then
    		print("player already has the gamepass")
    	else
    		MarketplaceService:PromptGamePassPurchase(player, DesertEagleGamepassID)
    	end
    end)

    OpenShop.MouseButtonDown:Connect (function()
    	MainFrame.Visible = not MainFrame.Visible
    end)
1 Like

What do you want it to do instead?

I would assume, though I am likely wrong, that they want it given once an event occurs with the player(I.E. they go from the lobby to a battlefield or they have to choose when to have it).