Heres my code below within a LocalScript in StarterCharacterScripts, there are no errors on the client when play testing.
Yes I know it looks like crap but it’s just a prototype of what I am actually working on.
local Context = game:GetService("ContextActionService")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animations = Humanoid.Parent.Animations
-- User doing an animation?
local AlreadyDoing = false
-- Animations
local Jump = Humanoid:LoadAnimation(Animations.Jump)
local Roar = Humanoid:LoadAnimation(Animations.Roar)
local Idle = Humanoid:LoadAnimation(Animations.Idle)
local Attack = Humanoid:LoadAnimation(Animations.Attack)
local Walk = Humanoid:LoadAnimation(Animations.Walk)
local SitIdle = Humanoid:LoadAnimation(Animations["Sit Idle"])
local Run = Humanoid:LoadAnimation(Animations.Run)
local Food = Humanoid:LoadAnimation(Animations.Food)
local function IdleFunc(action, state, keycode)
if AlreadyDoing then return end
if state == Enum.UserInputState.Begin then
if 0 < Humanoid.Health then
SitIdle:Stop()
Jump:Stop()
Idle:Play()
end
end
end
Context:BindAction("Idle", IdleFunc, true, Enum.KeyCode.Z)