Need help with Tycoon Money system

Basically, I’m making a tycoon. I was thinking of the following.
(I already made the dropper, its the money system i need help with)

  • (Normal Dropper) Every block spawned = $1.

  • (Advanced Dropper) Every Block spawned = $5

  • (Super Dropper) Every Block spawned = $10

  • GUI money system

So can someone give me a step by step? i can’t find the info I’m seeking
dropper scripts -

--// Variables
local Dropper = game.Workspace["Part 4"]
local ProximityPrompt = game.Workspace.proxy.ProximityPrompt
local Triggered = false

ProximityPrompt.Triggered:Connect(function()
	Triggered = true
end)

local function MakeBlock()
	local Block = Instance.new("Part")
	Block.Parent = workspace
	Block.CFrame = Dropper.CFrame
	Block.Size = Vector3.new(2, 1, 2)
	Block.Material = Enum.Material.Concrete
	Block.BrickColor = BrickColor.new("White")
	game.Debris:AddItem(Block, 2)
end

while true do
	if Triggered then
		task.wait(1.5)
		MakeBlock()
	end

	task.wait()
end

I have a screen gui prepared. (REMEMBER, MONEY ONLY RECIEVED WHEN THE DROPPER BLOCKS HAVE SPAWNED FROM Instance.New)

1 Like

Money System

Public or Private?

  • Public - Consider creating leaderstats; client accessible
  • Private - Consider using ReplicatedStorage accessible to client or ServerStorage which is not accessible to client and having to request the server for status update

Updating money on client?

  • Client accessible - Check this out and make the localscript GUI handler update the money status for every changes it detects.
  • Non-client accessible - Use RemoteEvents to fire as server and invoke the client for every value change of the player’s money held on ServerStorage.

Functions to change money?

  • Add/Subtract with checks - Make it so when the function is used, it can deploy a certain amount of money and check which player it will be addressed to. For example, addMoney(plr, amt).

Giving drops an amount?

  • Tables - Consider using table to format the rewards for each advancement of the dropper
  • Send functions back and forth - Assuming you’re making money and drop system a whole separate, make it so drop scripts can contact money system when it is spawned. Research BindableEvents. With some checking for security and stability, it could probably use addMoney() function.

Those are my step-by-step subjectively and what I found efficient to make the money system functional while connecting with dropper scripts. Sorry if this is somewhat unclear and vague, I tried to make it as understandable as possible while still letting it be fun to experience programming as you progress through these.

Leaderstats was in my mind. And I am considering that to be a better choice since it is a very easy process. Is there a way to link that leaderstat to a surface gui or a screen gui?

Yeah, you can link Leaderstats values to a GUI object, for example a text label. In the text label, write a local script:

local leaderstat = your leaderstats, for example money
local textlabel = script.Parent
textlabel.Text = leaderstat.Value

You can refer to this

You don’t have to do while true loop in order to update it every millisecond. You can use Changed/GetPropertyChangedSignal (which puts less stress on client’s processing)
Example

local player = game.Players.LocalPlayer
local money = player.leaderstats.NumberValue
local textLabel = player.StarterGui.ScreenGui.Frame.TextLabel

money:GetPropertyChangedSignal("Value"):Connect(function()
    textLabel.Text = money.Value
end)