Hello I am trying to make a Infinite Cash gamepass so it sets your cash to 10billion every time you join but for some reason it shows that it is at 10billion but if I gain any more cash it resets it back to what I gained such as 1.
local solariId = 18993213
local marketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (marketplaceService:UserOwnsGamePassAsync(player.UserId, solariId)) then
player:WaitForChild("leaderstats"):WaitForChild("Solari").Value = "10.0B+"
end
end)
The script is in serverscriptservice and it is not a local script
I think the other script utilizes a datastore to save the current cash amount of a player, and what your script does is just change the leader stat. It probably isn’t overriding that saved data.
script.Parent.Essentials.Giver.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if script.Parent.Owner.Value == player then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health > 0 then
if deb == false then
deb = true
script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Bright red")
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Stats ~= nil then
Sound(script.Parent.Essentials, Settings.Sounds.Collect)
Stats.Value = Stats.Value + Money.Value
Money.Value = 0
wait(1)
script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Sea green")
deb = false
end
end
end
end
Apparently, the kit makes a folder in ServerStorage called PlayerMoney that contains the money value of each player in the game. I think that’s the value you gotta change to 10 billion in order for your gamepass to work.
local solariId = 18993213
local marketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (marketplaceService:UserOwnsGamePassAsync(player.UserId, solariId)) then
Stats.Value = 1000000000
end
end)
I’m not sure if this is a LocalScript so that’s my guess.
yay Thank you very much! For anyone needing the code,
local solariId = 18993213
local marketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (marketplaceService:UserOwnsGamePassAsync(player.UserId, solariId)) then
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
Stats.Value = 10000000
end
end)
Hey, I’m trying to figure out how to do the same thing as you did. I tried using the script that worked for you but it’s not working for me, do you know why?
I put this script below in a server script inside of ServerScriptService.
local GamepassId = 38729509
local marketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (marketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId)) then
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
Stats.Value = 99000000
end
end)
The LocalScript inside of the TextButton that prompts the purchase is:
local GamepassId = 38729509
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
end)
The button that prompts the purchase works but it does not give the player any money. (Nothing at all happens)
I know nothing about scripting that’s why I’m using free models (Zed’s Tycoon Kit). Is there a tutorial out there on how to set up the PromptGamePassPurchaseFinished?