Why don't my gamepasses work until player quits & rejoins game?
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.
02 | local VipPlayers = { "test" } |
03 | local ToolName = { "test" } |
05 | local function FindPlayer(Plr) |
06 | for Num, Pler in pairs (VipPlayers) do |
13 | game.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) |
16 | for Num, Tool in pairs (ToolName) do |
17 | if game:GetService( "ServerStorage" ):FindFirstChild(Tool) then |
18 | game:GetService( "ServerStorage" ) [ Tool ] :Clone().Parent = Player.Backpack |
23 | for Num, Tool in pairs (ToolName) do |
24 | if Player.Backpack:FindFirstChild(Tool) = = nil then |
25 | if game:GetService( "ServerStorage" ):FindFirstChild(Tool) then |
26 | game:GetService( "ServerStorage" ) [ Tool ] :Clone().Parent = Player.Backpack |
This script is in the sign the user clicks on
1 | local CLICK_BLOCK = script.Parent |
2 | local gamePassId = 5555555 |
4 | local Click = Instance.new( "ClickDetector" ,CLICK_BLOCK) |
6 | Click.MouseClick:connect( function (UserID) |
7 | game:GetService( "MarketplaceService" ):PromptGamePassPurchase(UserID, gamePassId) |