I've made a tool to recover the value of an IntValue (HungerVal.Value). However, I need this tool to only be usable when the player's thirst and hunger IntValues are above 0. The below code still lets me use the tool when either of those IntValues equal 0, when it should instead be unusable while that condition is true.
local food = script.Parent
local plr = game.Players.LocalPlayer
local HungerVal = plr:WaitForChild("HungerVal")
local ThirstVal = plr:WaitForChild("ThirstVal")
local used = false
food.Activated:connect(function()
if HungerVal.Value and ThirstVal.Value > 0 then
HungerVal.Value = HungerVal.Value + 40
used = true
if HungerVal.Value > 100 then
HungerVal.Value = 100
end
food:Destroy()
else
print("I can't do that! I am unconcious!")
end
end)

2 comments
I see whats wrong now. Thanks.
Your welcome!