I want to create it where stamina increases over time, but not go over a limit.
The problem is, when I run the code, it constantly gives a attempt to compare number <= boolean when both attributes are numbers. I have tried changing the code and double-checking that the attributes are numbers, and they are.
print("Stamina: "..Stamina)
print("MaxStamina: "..MaxStamina)
if not Character:FindFirstChild("InCombat") and not StaminaRegenDB and not Stamina >= MaxStamina then -- line with error
Character:SetAttribute("Stamina", Character:GetAttribute("Stamina")+0.1)
StaminaRegenDB = true
delay(0.1,function()
StaminaRegenDB = false
end)
elseif Character:FindFirstChild("InCombat") and not StaminaRegenDB and not Stamina >= MaxStamina then
Character:SetAttribute("Stamina", Character:GetAttribute("Stamina")+0.1)
StaminaRegenDB = true
delay(0.5,function()
StaminaRegenDB = false
end)
end
This is the exact error it is giving:
Workspace.shadowcrafter2017.CharacterManager:49: attempt to compare number <= boolean - Server
Stack Begin - Studio
Script ‘Workspace.shadowcrafter2017.CharacterManager’, Line 49 - Studio
Stack End - Studio
Thank you in advance!