I’m making a burrito that heals a player when activated, it plays an animation and a sound, currently it does not damage the humanoid but plays the animations. I’m quite boggled to how it can be so, no errors occur
Script (Not a Local-Script)
local Tool = script.Parent
enabled = true
local timesToEat = 3
function onActivated()
if not enabled then
return
end
enabled = false
if Tool.Parent:FindFirstChild("Humanoid") then
Tool.Parent:FindFirstChild("Humanoid").Health = Tool.Parent:FindFirstChild("Humanoid").Health+10
Tool.Parent:FindFirstChild("Humanoid"):LoadAnimation(Tool.AnimationEat):Play(0.3)
end
if Tool.Parent:FindFirstChild("Head") then
local sound = Tool.Handle.EatSound:Clone()
sound.Parent = Tool.Parent:FindFirstChild("Head")
sound:Play()
game.Debris:AddItem(sound, sound.TimeLength)
sound.Ended:Wait()
end
if timesToEat ~= 0 then
timesToEat -= 1
print(timesToEat)
elseif timesToEat == 0 then
Tool:Destroy()
end
enabled = true
end
function onEquipped()
Tool.Handle.OpenSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
I’ve changed the local function to a direction function within the “:connect()” thing. I’ve been stuck on this for so long! I dont know if im missing something or im just stupid.