Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

A automatic money giver to add onto the balence a player has?

Asked by 9 years ago

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.

01function calculate(num)
02    return (num+math.random(-9,9))*math.random(1,10)/math.random(1,10)
03end
04 
05 
06calculate(1)
07print(calculate(20))
08for i = 1, 10 do print(calculate(10)*calculate(10)) end
09 
10 
11 
12function addSum(num, min)
13    if num<=min then
14        return num
15    end
16    return num+addSum(num-1, min)
17end

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" .

0
Scerzy, its not working! somethings wrong with it. JerryYoutube 6 — 9y

1 answer

Log in to vote
0
Answered by
Scerzy 85
9 years ago

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

01local 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 
12cash.Parent=stats
13kills.Parent=stats
14 
15function handleKillCount(humanoid, player)
View all 38 lines...

You can take the values of kills and cash and display it on your GUI without much problem.

0
why use "while 3.14 = 3.14" instead of "while true do"? They both to the same thing but one is simpler. AZDev 590 — 9y
Ad

Answer this question