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

Why don't my gamepasses work until player quits & rejoins game?

Asked by 6 years ago

Hello! I have my gamepasses set up where a player clicks on a sign and purchases the gamepass. When they purchase the gamepass, the "gear" they purchased does not appear in their inventory until they leave & come back.

Any suggestions?

Both scripts are in Workplace.

01local Id = 5555555 -- gamepass ID
02local VipPlayers = {"test"} -- VIP Player
03local ToolName = {"test"} -- Tools in ServerStorage
04 
05local function FindPlayer(Plr)
06    for Num, Pler in pairs(VipPlayers) do
07        if Pler == Plr then
08            return true
09        end
10    end
11end
12 
13game.Players.PlayerAdded:connect(function(Player)
14    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync()(Player.UserId, Id) or FindPlayer(Player.Name) then
15        Player.CharacterAdded:Connect(function(character)
View all 31 lines...

This script is in the sign the user clicks on

1local CLICK_BLOCK = script.Parent
2local gamePassId = 5555555
3 
4local Click = Instance.new("ClickDetector",CLICK_BLOCK)
5 
6Click.MouseClick:connect(function(UserID)
7    game:GetService("MarketplaceService"):PromptGamePassPurchase(UserID, gamePassId)
8end)

2 answers

Log in to vote
2
Answered by 6 years ago

Roblox saves the player's gamepasses when they join. When they check what gamepasses they have, they check the saved list. It's impossible (as far as I know) to re-check the gamepasses without the player rejoining.

Ad
Log in to vote
0
Answered by 6 years ago

AwesomeUniverseYT is right but you could try to give the person the gear after he bought it in his inventory and add the Gamepass so that he does not need to rejoin

0
I have tried tons of different things but can't seem to get that to work. Any suggestions on how to incorporate that in my script? bella_boopy 13 — 6y

Answer this question