Players = game:GetService("Players") FoStat = game.Players.LocalPlayer.FoodStat remoteEvent = game.ReplicatedStorage:WaitForChild("StatStart") FoodStatOn = false remoteEvent.OnServerEvent(function() FoodStatOn = true while FoodStatOn == true do wait(math.random(45, 120)) FoStat - math.random(-3, -6) end end)
FoStat - math.random on line 10 keeps getting an error expecting a function call or assignment. I've read and watched a bunch of tutorials and documentation on the while true do statement, can't find the problem.
In line 10, you got 2 mistakes. First, the first argument in math.random() needs to be a smaller number but -3 is greater than -6, swap them and the first mistake should be solved. Second, you cannot do FoStat -
, you have to do FoStat -= math.random(-6, -3)
or FoStat = FoStat - math.random(-6, -3)
.