Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to cast value to Object, Anyone can help me?

Asked by 4 years ago
Edited 4 years ago

I'm kind of new to LUA language, But I can't figure out why this code:

local animation = script:WaitForChild('Animation')

local humanoid = script.Parent:WaitForChild('Humanoid')

local Anim = humanoid:LoadAnimation('Animation') 

would give me that error... Help?

1 answer

Log in to vote
0
Answered by
BashGuy10 384 Moderation Voter
4 years ago
Edited 4 years ago

I think i have fixed those errors

Go read some of the learn roblox tutorials on the dev hub :)

local animation = script:WaitForChild('Animation')

local humanoid = script.Parent:WaitForChild('Humanoid')

local Anim = humanoid:LoadAnimation(animation) -- You did 'Animation' instead of animation, your problem is now fixed!


Also, put your code in a code block like this:

Step 1: Click "Code block" up at the top. THIS WILL CREATE A CODE BLOCK AT WHERE YOU ARE TYPING! Make sure to watch out! https://gyazo.com/a43a2507e62b9f335d16460da0175b0f

Step 2: Copy and paste code into the code block. https://gyazo.com/29bc2b9b117fb64b956db60170df7fcf

0
Thanks man, I really appreciate your help :) DatStxic 7 — 4y
0
Can you hit "Accept Answer" below my answer? It would help me a lot! BashGuy10 384 — 4y
View all comments (2 more)
0
WHAT BashGuy10 384 — 4y
0
its not there BashGuy10 384 — 4y
Ad

Answer this question