How to make an invest money system roblox

Yeah a deposit thing! like i said

This won’t work, because you’re setting the leaderboard value manually. You need to create a variable (for this I will say x) which is relative to what the player currently has. If somebody has 300, but you set it to 250, you are taking away 50 coins unfairly and for no valid reason, and, ultimately, you are taking away 100 coins, because that 50 coins would’ve been doubled. Also, you need to add a clicked event, because the author of the topic implied you need to click (and wait 10 seconds) to double the deposited amount of cash.

1 Like

@EruptingStudiosGD Have you tested out this solution yet? Would be nice to get some feedback on it.

Do I add on anything else onto your script?

Try using it as it is, and then if it doesn’t work, let me know and show me what errors you got in the output (if any), although it should work.

1 Like

didn’t work and no output on it

Did anything happen to the cash or no?

No it stayed the exact same no output

local cash = script.Parent.Parent.Leaderstats.cash.Value
---[[making a variable so I don't have to type alot everytime I need to say cash
script.Parent.MouseButton1Click:Connect(function()
     wait(10) -- waiting 10 seconds after click
	 cash = cash*2 --doubling cash
end

I forgot to mention the Value in the cash variable, sorry. Try this and let me know what happens.

the same nothing in output the leaderstats dont change

When the player dies while the script is still waiting those 10 seconds, do you want the investment to cancel?

No that would be bad also what about if they leave that’s a whole new thing.

100% how investing works.
I’ve played an investment game, but they got their own stock market system, so it’s not granted for you to profit.

You should make it actually like investing not a tycoon money machine

yeah that’s how I want the investment to be but its not like that

That’s weird. Everything should be working. Can you test the game, go to explorer, and show the children objects of your player within the explorer? (As well as everything within the leaderstats folder in the explorer)

explorer

Where is the script that is executing the code located? (Preferably show this in explorer)

explorer
the handler is to make the gui open

local plr = game.Players.LocalPlayer
local cash = plr.leaderstats.Cash.Value
script.Parent.MouseButton1Click:Connect(function()
     wait(10)
	 cash = cash*2 
end

nope the same thing again hmmm