Ad
Log in to vote
0

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

Asked by 11 months ago
Edited 11 months ago

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

Log in to vote
1
Answered by 11 months ago
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.

0
How Would I Make The First Part Into A Variable? ricelicker 52 — 11mo
Ad

Answer this question