1This is my first time making a gamepass for a game, I want the “ThanosSpeed” item to go into the player’s inventory after they bought it, like other games.
Whenever I playtest through “Play” and buys the gamepass, it works normally and gives me the item and stuff.
My problem is that when I do a “TeamTest” with my friends or alone, it literally just stops working and does not give the item, although it still has the “Purchase Gamepass?” prompt.
Here is the script for activating the purchase prompt by stepping onto a pad, this is a normal script:
local GamePassfolder = script.Parent.thanosModel
local marketplaceService = game:GetService("MarketplaceService")
local gamepassID = 1016932754
for _, child in pairs(GamePassfolder:GetChildren()) do
child.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
marketplaceService:PromptGamePassPurchase(player, gamepassID)
end
end)
end
And heres the gamepass code function code
local MarketplaceService = game:GetService("MarketplaceService")
local thanosID = 1016932754
local function giveThanos(player)
local thanosSpeed = game.ServerStorage:FindFirstChild("thanosSpeed")
if thanosSpeed then
local clonedThanosSpeed = thanosSpeed:Clone()
clonedThanosSpeed.Parent = player.Backpack
if not player.StarterGear:FindFirstChild(thanosSpeed.Name) then
local clonedThanosSpeed = thanosSpeed:Clone()
clonedThanosSpeed.Parent = player.StarterGear
end
end
end
game.Players.PlayerAdded:Connect(function(player)
local hasThanosGamepass = false
local success, errorMsg = pcall(function()
MarketplaceService:UserOwnsGamePassAsync(player.UserId, thanosID)
end)
if not success then
error(errorMsg)
end
if hasThanosGamepass then
print(player.Name .. "has ThanosGamePassWhenJoining")
giveThanos(player)
end
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if purchased and id == thanosID then
print(player.Name .. "just got scammed with the thanos game pass")
giveThanos(player)
end
end)
I’ve tried to look for solutions but they didn’t work, probably because I’m pretty new to scripting in Roblox. Any help would be incredibly appreciated, Thanks!