Infinite money gamepass script not working

Hey, I’m trying to make an infinite money game pass on my script by giving users who own it a vast amount of money when they join, but it does not seem to be working. I’ve been trying for a while. No errors are in the output.

wait(1)
local Players = game:GetService('Players')

local MarketPlaceService = game:GetService('MarketplaceService')

local GamepassId = 91920947

Players.PlayerAdded:Connect(function(Player)
	if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
		Player.leaderstats.Money.Value = 9999999999999
	end
end)
3 Likes

Remove the wait(1) in the script.

1 Like

Still doesn’t work, added that just to give the cash time to load before so this script does not load before the datastore cash loads and just does not work.

1 Like

Well, you should probably use :WaitForChild() when adding the money.

local Players = game:GetService('Players')

local MarketPlaceService = game:GetService('MarketplaceService')

local GamepassId = 91920947

Players.PlayerAdded:Connect(function(Player)
	if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
		Player:WaitForChild("leaderstats").Money.Value = 9999999999999
	end
end)
1 Like

Didn’t work, made the datastore script just scream for help by saying nil and saying too many requests.

1 Like

I think the nil and the too many requests aren’t due to this script.

1 Like

Well, I put it back to the original and now it only says “Data Loaded”

1 Like

If that’s the case, there is no way this is the whole script. But, you might as well change it to a print real quick just for testing.

local Players = game:GetService('Players')

local MarketPlaceService = game:GetService('MarketplaceService')

local GamepassId = 91920947

Players.PlayerAdded:Connect(function(Player)
	if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
		print("owns")
	end
end)
1 Like

It is the whole script, however, the owns was printed.
image

1 Like

Then I’m not sure why the script errored, but here:

local Players = game:GetService('Players')

local MarketPlaceService = game:GetService('MarketplaceService')

local GamepassId = 91920947

Players.PlayerAdded:Connect(function(Player)
	if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
		local leaderstats = Player:WaitForChild("leaderstats")
		local money = leaderstats:WaitForChild("Money")
		
		if money then
			money.Value = 9999999999
		end
	end
end)
3 Likes

Data was loaded successfully, however it did not work. Again, no errors.

wait(1)
local Players = game:GetService('Players')
local MarketPlaceService = game:GetService('MarketplaceService')
local GamepassId = 91920947

function GiveMoney(Player)
	if Player:GetAttribute("CheckGamepass") == nil then
		Player:SetAttribute("CheckGamepass",true)
		local leaderstats = Player:WaitForChild("leaderstats")
		local Money = leaderstats:WaitForChild("Money")
		if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
			Money.Value = 9999999999999
		end 
	end
end

Players.PlayerAdded:Connect(function(Player)
	GiveMoney(Player)	
end)

for _,player in pairs(Players:GetPlayers()) do
	GiveMoney(player)	
end

2 Likes

just a small change

Money.Value = math.huge

You can also do 1/0 to get inf

Wouldn’t that return undefined?

According to the IEEE-754 standard no

Why 1/0 is inf in the IEEE-754 standard (stackoverflow)

No actually try print(1/0 == math.huge) it will return true

2 Likes

Thats so weird, I never knew 1/0 was inf

1 Like

Neither did I.

@ketrab2004 Thanks for the info!

Or use math.huge, if you use that it will only create confusion, make it readable not complicated.