local Z if hum.RigType==Enum.HumanoidRigType.R6 then Z=script.Parent.TakeABiteR6 else Z=script.Parent.TakeABiteR15 end local R=hum:LoadAnimation(Z)script.Parent.Activated:connect(function()if not eating then eating=true R:Play()R.KeyframeReached:Connect(function(Z)if Z=="\066\105\116\101"then sound.TimePosition=.3 sound:Play()wait(.5)script.Parent.BiteTaken:FireServer()end end)end end)R.Stopped:Connect(function()script.Parent.AppleFinished:FireServer()end)

local eatingAnimation
if hum.RigType == Enum.HumanoidRigType.R6 then
	eatingAnimation = script.Parent.TakeABiteR6
else
	eatingAnimation = script.Parent.TakeABiteR15
end
local eatingAnim = hum:LoadAnimation(eatingAnimation)

script.Parent.Activated:connect(function()
	if not eating then
		eating = true
		eatingAnim:Play()
		eatingAnim.KeyframeReached:Connect(function(keyFrame)
			if keyFrame == "Bite" then
				sound.TimePosition = 0.3
				sound:Play()
				wait(0.5)
				script.Parent.BiteTaken:FireServer()
			end
		end)
	end
end)

eatingAnim.Stopped:Connect(function()
	script.Parent.AppleFinished:FireServer()
end)
