So I made a digging animation for my game, and am able to get it to work just fine on a dummy. However, when I try to load the animation on the player, it gives me the error "Unable to cast value to object" and I'm not sure what that means in this context.
Here is the code for the animation working just fine on the dummy:
local dummy = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local digAnimation = ReplicatedStorage.Animations.Dig
local humanoid = dummy.Humanoid
local digAnimationTrack = humanoid:LoadAnimation(digAnimation)
digAnimationTrack.Looped = true
digAnimationTrack:Play()
and here are the relevant pieces of code for the player trying to run the animation:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local digAnimation = ReplicatedStorage.Animations.Dig
local function digAnimation(part, humanoid)
-- Digging
local digAnimationTrack = humanoid:LoadAnimation(digAnimation)
digAnimationTrack.Looped = true
digAnimationTrack:Play()
-- some other stuff below here
The error occurs on the line local digAnimationTrack = humanoid:LoadAnimation(digAnimation) and the link to the animation is here
Lastly, I should mention that both the player and the dummy have a shovel model attached to their right hand, in case that has anything to do with it.
