I have a script that is supposed to print the JumpHeight of the player. It was working until about an hour ago. I never changed anything to the script, yet when I change the JumpHeight of the player, it still prints the original value.
script:
local Player = game.Players.LocalPlayer
local humanoid = Player.Character:WaitForChild("Humanoid")
local JumpHeight = humanoid.JumpHeight
while wait() do
print(JumpHeight)
end
For one thing, you shouldn’t be using while loops often. Second, I’m not sure if this will work but instead of making a local for the jump height, instead print(humanoid.JumpHeight).
When you do a specific value as a variable, it won’t update automatically. This is useful in some cases: example storing the old transparency of a door, so you can set it back later.
Well, maybe you can update the old value in the loop.
Example:
local Player = game.Players.LocalPlayer
local humanoid = Player.Character:WaitForChild("Humanoid")
local JumpHeight = humanoid.JumpHeight
while wait() do
JumpHeight = humanoid.JumpHeight
print(JumpHeight)
end