GamePass wont work after reseting or leaving and joining again

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?

I just wrote this :

local gamePassID = 15190401
local marketPlace = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	local char = game.Workspace:FindFirstChild(player.Name)
	local hasPass = false
	local success,err = pcall(function()
		hasPass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
	end)
	
	if hasPass then
		char:WaitForChild("Humanoid").WalkSpeed = 200
	end
	
	if char:WaitForChild("Humanoid").Health == 0 and hasPass then
		char:WaitForChild("Humanoid").WalkSpeed = 200
	end
end)
1 Like