how to make a money system

[P00R] 34107
Joined 21/04/2022
Posts 329
10:40 AM 11/02/2023
where you get $1 every 30 seconds and you can buy tools in the game with the money

this would really help

thanks


[P00R] Reebeen123
Joined 02/02/2023
Posts 34
12:21 AM 26/02/2023
EEEEEEEEE


[Glith] HolisReborn
Joined 04/05/2021
Posts 930
09:08 PM 08/03/2023
let money = 0;
let timer = setInterval(function() {
money += 1;
console.log("You now have $" + money);
}, 30000);

// Example tool purchase
function buyTool(toolName, cost) {
if (money >= cost) {
money -= cost;
console.log("You have purchased " + toolName + " for $" + cost);
} else {
console.log("You do not have enough money to purchase " + toolName);
}
}

// Usage:
buyTool("Hammer", 5); // Attempt to buy a Hammer for $5


[RWB] MixaMega
Joined 23/12/2019
Posts 435
Moderator
11:36 PM 08/03/2023
Quote from HolisReborn , 09:08 PM 08/03/2023
let money = 0;
let timer = setInterval(function() {
money += 1;
console.log("You now have $" + money);
}, 30000);

// Example tool purchase
function buyTool(toolName, cost) {
if (money >= cost) {
money -= cost;
console.log("You have purchased " + toolName + " for $" + cost);
} else {
console.log("You do not have enough money to purchase " + toolName);
}
}

// Usage:
buyTool("Hammer", 5); // Attempt to buy a Hammer for $5
this was written by either chatgpt or someone that knows js but doesnt know nodehill


[RWB] MixaMega
Joined 23/12/2019
Posts 435
Moderator
11:51 PM 08/03/2023
so heres an answer that wasnt written by an ai

https://gist.github.com/MixaMega/d97a15c2edea86bffcc076dcb76ca65e

1