Why does my Gamepass work when I presss "Play", but when I do team test it doesn't work anymore

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!

2 Likes

I’m pretty sure the gamepasses do not work in team - test I might be wrong, try loading up into the actual game on Roblox to test it. everything in the script looks good to me but I might be wrong

1 Like

Hi, thanks so much for responding, is there a way for me to test it in the actual game, without costing robux?

You can test in studio trough the test server everytime you rejoin you need to buy it again or if you not own the pass you also can in normal test also you can have premium membership in studio by subscribe through studio so long if you are in the test session you can use premium features

you should own all of your game’s gamepasses by default

Ahh okay I see it now, tysm for helping me

well there’s no way to do it specifically. since you should own all of them. but if you don’t you can set a price up and i’ll help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.