Gamepass tools giver ain't working

Fix the gamepass script

  1. What is the issue? Sometimes it works and sometime it doesn’t

  2. What solutions have you tried so far? Add WaitForChildren

game.Players.PlayerAdded:connect(function(player)
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId, 21467825 ) then
			if player.Backpack:FindFirstChild("Flamethrower") == nil then
			end
			print(player.Name .. " got an item!")
			local b = game.ServerStorage:FindFirstChild("Flamethrower"):Clone()
			b.Parent = player.Backpack
		end
	wait(1)     
end)


What’s the point of if player.Backpack:FindFirstChild("Flamethrower") == nil then end?

Are there any errors in the output?

There’s also no point in the wait(1)

the tool giver is outside of the if statement that checks if the player doesnt have a flamethrower, along with the fact that when you equip a tool, it moves to the players character (in workspace), thus making it no longer in backpack but instead in workspace.PlayerName, so also check the players character

Try using .UserId instead of .userId also, try treating :userownsgamepass like a boolean in the if statement. like check if userowns gamepass is true.