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

Adding a 2x Cash Gamepass?

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

1 comment

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

1 answer

✓ Accepted answer

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.

2 comments

0

Thank you so much

0

Hello is this Local script ? and where do i place this script

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