Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How Do I Regenerate IntValues?

Background: I am starting a project to recreate Zelda Breath Of The Wild in Roblox (It's a huge project I probably wont ever finish). Currently I am working on the glider/stamina script at the moment and cant seem to get the stamina regeneration to work.

Problem: When testing, the Gliding.Value == false, my Stamina.Value is less than my MaxStamina.Value and my Stamina.Value will not increase. What is going on?

Script -

while Stamina.Value < MaxStamina.Value do
	if Gliding.Value == false then
		wait(1)
		Stamina.Value = Stamina.Value + 1
	end
end

2 comments

0

That is not the entire script, but if it is a simple organisation error you probably don't need the rest of the code (It is a total of 54 lines).

0

Might I suggest using the .Changed event?

1 answer

Your while loop will run until Stamina.Value gets lower then MaxStamina.value.

Also, if your Gliding.Value would be true at the moment the thread begins in this while loop, your game will freeze.

1 comment

0

can you write a fixed version, I am having a hard time wrapping my head round this.

This discussion is preserved as it was. New answers, comments, and votes are closed.