Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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)

~~~~~~~~~~~~~~~~~

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. alphawolvess 1784 — 9y
0
Also, You need to put your script inside of the ~~~~ lines, where that open space is. Not outside. alphawolvess 1784 — 9y
0
I meant, the gamepasses are being bought IN GAME in a GUI. SourceDev 0 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)
0
so where do i put the rewards bit and where does that script go SourceDev 0 — 9y
Ad

Answer this question