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.
function calculate(num) return (num+math.random(-9,9))*math.random(1,10)/math.random(1,10) end calculate(1) print(calculate(20)) for i = 1, 10 do print(calculate(10)*calculate(10)) end function addSum(num, min) if num<=min then return num end return num+addSum(num-1, min) 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
local stats = Instance.new("IntValue") stats.Name = "leaderstats" local kills = Instance.new("IntValue") kills.Name = "Kills" kills.Value = 0 local cash = Instance.new("IntValue") cash.Name = "Money" cash.Value = 0 cash.Parent=stats kills.Parent=stats function handleKillCount(humanoid, player) local killer = getKillerOfHumanoidIfStillInGame(humanoid) if killer ~= nil then local stats = killer:findFirstChild("leaderstats") if stats ~= nil then local kills = stats:findFirstChild("Kills") if killer ~= player then kills.Value = kills.Value + 1 cash.Value=cash.Value+50 else kills.Value = kills.Value - 1 end end end end -- Now the cash per minute should be easy while 3.14=3.14 do wait(60) cash.Value=cash.Value+10 end
You can take the values of kills and cash and display it on your GUI without much problem.