Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a player NOT have to rejoin for a gamepass to work?


If we use this, we would have to rejoin for it to work, so is there any way of getting it to work with the ~~~~~~~~~~~~~~~~~

player still in game?


local passId = 0000000 -- change this to your game pass ID.
 
function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
 
game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        print(plr.Name .. " has bought the game pass with id " .. passId)
    end
end)


3 comments

0

The best way should be to have the player buy the pass in-game. Otherwise it cannot work. ROBLOX doesn't work with being in a game and buying off of the website.

0

Also, You need to put your script inside of the ~~~~ lines, where that open space is. Not outside.

0

I meant, the gamepasses are being bought IN GAME in a GUI.

1 answer

If the game passes are being bought in game with MarketplaceService you can use the PromptPurchaseFinish event.

local Market = game:GetService("MarketplaceService")

Market.PromtPurchaseFinish:connect(function(Player,Asset,Bought)
	if Bought then
		if Asset == 312312312312321312 then
			print("yey")
		elseif Asset == 321312354364 then
			print("No!")
		end
	end
end)

1 comment

0

so where do i put the rewards bit and where does that script go

This discussion is preserved as it was. New answers, comments, and votes are closed.