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

Problem with math?

Asked by 8 years ago
e = 0
game.Players.LocalPlayer.status.Changed:connect(function() 
for i,v in pairs(_G.money) do
    e = e+1 -- to get the amount in the table. wait, i could just use #. oh well, its the same thing
end
local average = 0
for i,v in pairs(_G.money) do
    average = average + v -- v is a number, so this will get all the numbers added together.
end
average = average/e -- gets the average
average = average* (game.Players.LocalPlayer.turn.Value/10) -- the turn value is a number, which is divided by ten. and then it gets multiplied by that
print(average) -- prints here, and it prints a different number every time the status value changes
game.Players.LocalPlayer.deal.Value = math.floor(average) -- math floor because deciamals
average = 0 -- resets i, maybe
print(average) -- prints 0, so i guess it does reset
end) 

this prints a different number every time my status value changes. And I'm pretty sure it's not supposed to.

1
When it changes,it means that most likely the number will have changed, meaning there will be a different average. TheDeadlyPanther 2460 — 8y
0
the number doesnt change ScriptsAhoy 202 — 8y

Answer this question