I have animals dropping meat when defeated but only the first meat that drops is adding food when players click it. Here it is, It's a local script.
local Hunger = script.Parent.Stats["Food/Hunger"].Hunger
local Meat = workspace:WaitForChild("Meat", .1)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local EatAnimation = Character.Humanoid:LoadAnimation(Character.Animations.Eat)
local Mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
Meat.ClickDetector.MouseClick:Connect(function(player)
local Target = Mouse.Target
if debounce == false and Hunger.Value < 100 and Target.Name == "Meat" then
debounce = true
EatAnimation:Play()
Hunger.Value = Hunger.Value + 10
script.Parent.Stats.Values.Hunger.Text = Hunger.Value
wait(2)
debounce = false
end
end)

1 comment
lol