Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adding a 2x Cash Gamepass?

Asked by 5 years ago

This is the First Tycoon that I have ever made and I am confused on how to add a 2x Cash script and where to put it? Do I just make a separate script and loop it so it doubles the crash every second?

I am using Zednov's Tycoon Kit

0
I think that you shoul add in script that is in pad that the player steps on and give money you shoul add that detects if you have game pass and that givrs you double the money dinozaver_triceratop 78 — 5y

1 answer

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
5 years ago

Hello.

local MarketpalceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local MoneyToCollect = 50
local CollectMoneyBrick = game.Workspace:WaitForChild("CollectMoneyBrick")

--[[
    Okay. Let's say that the player has to collect 50 money to collect. Below, we will check if 
    the player has the 2X Money gamepass with the ID 1 (for example).
--]]

CollectMoneyBrick.Touched:Connect(function(object) -- Object = Hand, Leg etc. Object.Parent = Player's Character. Object.Parent.Name = Player's Character Name, which is player's name.
    if MarketpalceService:UserOwnsGamePassAsync(Players:GetUserIdFromNameAsync(object.Parent.Name), 1) then -- Change 1 with the gamepass ID to test it.
        print("User owns the 2X Gamepass.")
        print("Money to colect: "..MoneyToCollect * 2) -- It would be 50 * 2 which is 100.
    else
        print("User does not own the 2X Gamepass.")
        print("Money to collect: " ..MoneyToCollect) -- It would be 50.
    end
end)

--[[
    MarketplaceService:UserOwnsGamePassAsync Syntax:
    MarketplaceService:UserOwnsGamePassAsync(UserId, GamepassId) | It will return true or false.
--]]

Basically, you check if the user has the gamepass. If yes, you'll * 2 the money. If not, give him the current money. Note: Make sure you do this on the Server.

0
Thank you so much DanielRocky 4 — 5y
0
Hello is this Local script ? and where do i place this script kiritousd -5 — 3y
Ad

Answer this question