GamePass wont work after reseting or leaving and joining again

The walkspeed is still the same. And I wrote :

game.Players.PlayerAdded:Connect(function(player)
	local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
	if hasSpeedGamePass then
		print(player.Name .. " owns the gamepass")
		--Make a characterAdded conection
		player.CharacterAdded:Connect(function(Character)
			Character.Humanoid.WalkSpeed = 200
		end)
	end
end)

And nothing printed in the output…

That means the hasSpeedGamePass boolean is not true, which means the connection will never be made. Check if the GamepassID is correct and if you are using the correct reference for MarketPlaceService, you can also check if hasSpeedGamePass is actually “false” and not nil.

Update: I tested the same script in-game and it worked completly fine for me.

It’s printing false in the output when I bought the gamepass

And I tested it in game and actually bought it. And I was able to keep buying it somehow…

By in-game do you mean in an actual game or in Roblox Studio?

UserOwnsGamePassAsync being false right when the player bought gamepass seems to be a Roblox issue, as seem on this threads:

But it should be fine after some seconds.

I have no idea about this, I’ve managed to find a thread that seemed to have this same issue, maybe it can help you:

In the actual game and in roblox studio. They both don’t work and keep printing in the output false but I did buy the gamepass…

Code:

local speedGamePassImageButton = script.Parent
local speedGamePassLabel = script.Parent.SpeedGamePassLabel
local marketPlace = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local gamePassID = 15190401

speedGamePassImageButton.MouseButton1Up:Connect(function()
	marketPlace:PromptGamePassPurchase(player, gamePassID)
	
	marketPlace.PromptGamePassPurchaseFinished:Connect(function(player, ID, wasBought)
		if wasBought and ID == gamePassID then
			print(marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID))
			player.Character:WaitForChild("Humanoid").WalkSpeed = 200
			speedGamePassLabel.Text = "Successfully bought speed gamepass!"
			wait(3)
			speedGamePassLabel.Text = "If you buy the speed gamepass, you will be granted extra speed!"
		end
	end)
end)



game.Players.PlayerAdded:Connect(function()
	local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
	if hasSpeedGamePass then
		print(player.Name .. " owns the gamepass")
		--Make a characterAdded conection
		player.CharacterAdded:Connect(function(Character)
			Character.Humanoid.WalkSpeed = 200
		end)
	end
end)

Output:

Screenshot (77)

Oh wait I think I know the problem. I’m not sure if this will run any different then what you already did but on my game it works, so maybe it will here.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
			char.Humanoid.WalkSpeed = 50
		end
	end)
end)

What you did was you made a local Boolean variable that checks if the user owns the gamepass, and then using that value you made an if statement. In this script, if they own the gamepass then it instantly runs the script.

Doesn’t works somehow… :sad:

Instead of that variable id, did you put in your own gamepass id?

Yeah, and I changed ‘connect’ to an uppercase C.

I even tried to wrap it in a pcall and print the error, but it won’t print the error. It’s just printing false and saying I don’t have the gamepass

local speedGamePassImageButton = script.Parent
local speedGamePassLabel = script.Parent.SpeedGamePassLabel
local marketPlace = game:GetService("MarketplaceService")
local gamePassID = 15190401



game.Players.PlayerAdded:Connect(function(player)
	speedGamePassImageButton.MouseButton1Up:Connect(function()
		marketPlace:PromptGamePassPurchase(player, gamePassID)

		marketPlace.PromptGamePassPurchaseFinished:Connect(function(player, ID, wasBought)
			if wasBought and ID == gamePassID then
				print(marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID))
				player.Character:WaitForChild("Humanoid").WalkSpeed = 200
				speedGamePassLabel.Text = "Successfully bought speed gamepass!"
				wait(3)
				speedGamePassLabel.Text = "If you buy the speed gamepass, you will be granted extra speed!"
			end
		end)
	end)
	
	
	local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
	if hasSpeedGamePass then
		print(player.Name .. " owns the gamepass")
		--Make a characterAdded conection
		player.CharacterAdded:Connect(function(Character)
			Character.Humanoid.WalkSpeed = 200
		end)
	end
end)

Can’t you just

local Player = game.Players.LocalPlayer
local gamePassID = 15190401
local MarketPlace = game:GetService("MarketplaceService")

Player.CharacterAdded:Connect(function()
    if MarketPlace:UserOwnsGamePassAsync(Player.UserId, gamePassId) then
        Player.Character.Humanoid.WalkSpeed = 200
        print(Player.Name.." has the gamepass")
    end
end)

Also make sure that API Services/HTTP Requests are turned on

This error seems very unusual. Could you send me a link to the file for the game and I could try and see what the problem is

Game: FireBall Mania - Roblox

That wont let me edit it or even enter it. You will have to make it uncopylocked.

I fixed it. Play it now, thanks for replying btw

Oh ok, just wondering, how did you manage to fix it?