I am having a few issues writing code for my automatic money giver which adds onto the balence of money a player has and I was going to ask an expert but i cant so im asking you guys. Since you guys are pro at coding. I need a money giver which gives virtual money "fake" money (not real) to all the players playing and gives then money when they kill another player, 50 coins for the kill and 10 coins a minute. can I pls have some help? I do have a calculator script though.
01 | function calculate(num) |
02 | return (num+math.random(- 9 , 9 ))*math.random( 1 , 10 )/math.random( 1 , 10 ) |
03 | end |
04 |
05 |
06 | calculate( 1 ) |
07 | print (calculate( 20 )) |
08 | for i = 1 , 10 do print (calculate( 10 )*calculate( 10 )) end |
09 |
10 |
11 |
12 | function addSum(num, min) |
13 | if num< = min then |
14 | return num |
15 | end |
16 | return num+addSum(num- 1 , min) |
17 | end |
So yeah... Help would be apriciated. Oh and by the way I have done it through GUIs so the money has to apear onscreen when I open up a menu Called "Shop" .
I'm not sure what your script even is. I think the easiest way to do this is through a leaderboard.
Here is the gist of it, it shouldnt be too hard to script
01 | local stats = Instance.new( "IntValue" ) |
02 | stats.Name = "leaderstats" |
03 |
04 | local kills = Instance.new( "IntValue" ) |
05 | kills.Name = "Kills" |
06 | kills.Value = 0 |
07 |
08 | local cash = Instance.new( "IntValue" ) |
09 | cash.Name = "Money" |
10 | cash.Value = 0 |
11 |
12 | cash.Parent = stats |
13 | kills.Parent = stats |
14 |
15 | function handleKillCount(humanoid, player) |
You can take the values of kills and cash and display it on your GUI without much problem.