When I Was Making Script That Make Sure People Not OverEat Food For My Hunger System, Trouble Happened, Normally, Food Will Disappear After Some Second When Eated, But It Not Disappear When Your Health Is Under 80, Any Help?
Tool = script.Parent
debounce = false
Tool.Activated:connect(function(mouse)
local hum = Tool.Parent:FindFirstChild("Humanoid")
if (hum ~= nil) and not debounce then
debounce = true
wait(2)
hum.Health = hum.Health + 15
local ps = game:GetService("Players")
local player = ps:GetPlayerFromCharacter(hum.Parent)
local hunger = player:FindFirstChild("Hunger")
hunger.Value = hunger.Value + 20
if hunger.Value >= 100 then
hunger.Value = 100
wait(3)
Tool:Remove()
end end end)
Tool.Equipped:connect(function(mouse)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
end)

1 comment
Thanks For Helping!, I Am Begginer To Scripting But Now I Understanded Why, Take My Respect!