Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Would I Expand On This Script And Make It A Double Cash Gamepass?

I Have A Simulator Game Where You Collect Coins And Sell Them For Cash, Currently, I Am Trying To Make A Double Points Gamepass. I Have Very Limited Knowledge With Roblox Lua And Money Systems So Please Excuse My Mistakes.

game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id)
if player then
	local leaderstats = player:WaitForChild("leaderstats")
	local Currency = leaderstats.Money -- Change Money To your currency
	local Selling = leaderstats.Coins -- Change Grass to what you selling.
		if Selling.Value > 0 then
			Currency.Value = Currency.Value + Selling.Value *1.5 -- This 1 means multiple you can change it to whatever you want
			Selling.Value = 0
		end
end
end
end)

1 answer

✓ Accepted answer
local owns = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id)

Make that into a variable, it will return true or false depending if the User owns the game pass.

local CurrentMultiplier = 1

if owns then
	CurrentMultiplier = 2
end

if player then
    local leaderstats = player:WaitForChild("leaderstats")
    local Currency = leaderstats.Money
    local Selling = leaderstats.Coins
        if Selling.Value > 0 then
            Currency.Value = Currency.Value + Selling.Value *1.5 * CurrentMultiplier
            Selling.Value = 0
        end
end
end
end)

If the player owns the gamePass, then his Current Multiplier will raise by 2X.

1 comment

0

How Would I Make The First Part Into A Variable?

This discussion is preserved as it was. New answers, comments, and votes are closed.