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.
local Id = 5555555 -- gamepass ID
local VipPlayers = {"test"} -- VIP Player
local ToolName = {"test"} -- Tools in ServerStorage
local function FindPlayer(Plr)
for Num, Pler in pairs(VipPlayers) do
if Pler == Plr then
return true
end
end
end
game.Players.PlayerAdded:connect(function(Player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync()(Player.UserId, Id) or FindPlayer(Player.Name) then
Player.CharacterAdded:Connect(function(character)
for Num, Tool in pairs(ToolName) do
if game:GetService("ServerStorage"):FindFirstChild(Tool) then
game:GetService("ServerStorage")[Tool]:Clone().Parent = Player.Backpack
end
end
end)
for Num, Tool in pairs(ToolName) do
if Player.Backpack:FindFirstChild(Tool) == nil then
if game:GetService("ServerStorage"):FindFirstChild(Tool) then
game:GetService("ServerStorage")[Tool]:Clone().Parent = Player.Backpack
end
end
end
end
end)
This script is in the sign the user clicks on
local CLICK_BLOCK = script.Parent
local gamePassId = 5555555
local Click = Instance.new("ClickDetector",CLICK_BLOCK)
Click.MouseClick:connect(function(UserID)
game:GetService("MarketplaceService"):PromptGamePassPurchase(UserID, gamePassId)
end)

1 comment
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?