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)
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.
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)
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)
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)
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