Hello! Hope your having a good day!
I’ve encountered problem with my stamina,
The While loop wont end after I end my UIS.
player.Character:WaitForChild("Humanoid").Running:Connect(function()
if Character:WaitForChild("Humanoid").MoveDirection.Magnitude > 0 then
UIS.InputBegan:Connect(function(IN, IS)
if IS then return end
if IN.KeyCode == RunningKey then
if player.StaminaArea.Stamina.Value > 0 then
Character:WaitForChild("Humanoid").WalkSpeed = speed
YK = true
while player.StaminaArea.Stamina.Value >= 0 and task.wait(.2) do
task.wait(.2)
player.StaminaArea.Stamina.Value -= 1 --Call this the Minus Value
if YK == false then
break
end
end
end
end
end)
UIS.InputEnded:Connect(function(IN, IS)
if IS then return end
if IN.KeyCode == RunningKey then
Character:WaitForChild("Humanoid").WalkSpeed = NS
YK = false
end
end)
else
UIS.InputEnded:Connect(function(IN, IS)
if IS then return end
if IN.KeyCode == RunningKey then
Character:WaitForChild("Humanoid").WalkSpeed = NS
YK = false
end
end)
end
end)
Every time the UIS is cancelled, the Minus value is timed by 2 each time its activated.
It has been bugging me ever since i thought of the idea and wish this is fixed real soon.
Thank you.