Hello, I’m trying to create a stamina system along with other stats, but the stamina levels won’t update. I don’t really script anything past basic level but I know how to use the Naturestore module so I have been using that as a datastore and have been trying to get all these stats to update live in the playerdata as much as I can.
At first it ran on a lot of “while true do” segments but I removed all of them but the main one and everything works still so I figured that wasn’t the problem.
A little background about how the script is supposed to function with other scripts. The “Leaelly” is the character I am using and has a localscript in it that works the controls, when it goes into a sprinting mode from the localscript, a remote event is firing to set a bool value to true(or false if they stop sprinting) that this script is supposed to read. All of the previous works fine, but when it comes to the code below it seems to do nothing, no errors on the output, doesn’t print the quoted text in the output either.
while true do
--Energy Regen
Energy = Data.LeaellyEnergy.Value
if Energy < 100 and Sprinting == false then
wait(2)
NatureStore:IncrementData(plr.UserId, "LeaellyEnergy", 1)
repeat until Energy == 100
end
end
if Sprinting == true then
print("running")
wait(1)
NatureStore:IncrementData(plr.UserId, "LeaellyEnergy", -1)
elseif Sprinting == true and Data.LeaellyEnergy.Value <= 0 then
Sprinting = false
elseif Sprinting == false then
end
end
I do have all the appropriate globals/locals in a directory at the top of the script. I’m at quite a loss, been trying to fix this for hours. That last elseif statement was another attempt at fixing the problem, but I never expected it to do anything either.