I'm trying to get this idle animation for my gun to load, but it keeps giving me the "Unable to cast value to object" error. I'm not sure how to go about with this error, and I don't know where to start to solve this issue.
tool.Equipped:Connect(function(mouse)
Equipped = true
local h = Player.Character.Humanoid:LoadAnimation("Idle")
h:Play()
end
It sends me to this block of code every time it gives me the error. So this is the point where I am stuck. Mind helping me?

4 comments
Which line is it on?
Line 3.
Do you have a Player variable? We need to see the whole script.
I fixed it. I accidentally use the name of the animation as a string value.