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

Why Wont Humanoid:LoadAnimation Work?

Asked by 4 years ago

Okay so, I was trying to make a animation for my coin to spin, and it didn't work, Could somebody please help me out with this, im not very good at this stuff

local animation = script:WaitForChild('Animation')
local Humanoid = script.Parent.Parent:WaitForChild('Humanoid')
local spin = Humanoid:LoadAnimation(animation)
    spin:Play()

Help

0
Hey why don't you accept my answer Shounak123 461 — 4y
0
Click "Accept Answer" Beside my question and your question will then be viewed as answered Shounak123 461 — 4y
0
Oh, Thanks Galaxybombboy 134 — 4y
0
no problem Shounak123 461 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Objects doesn't work like that. Objects are unable to cast animations. What you can do is insert a script in the coin and write the following:

while true do
    local frame = script.Parent.CFrame
    local target =  frame*CFrame.fromEulerAnglesXYZ(0,0.05,0)
    script.Parent.CFrame = target
    wait()
end

If the script spins the coin in the wrong direction, you can change the 0.05 another place after fromEulerAnglesXYZ(NumberX, NumberY, NumberZ) . It is currently on the NumberY place. Change it to NumberX place or the NumberZ place if it spins in the wrong direction.

0
I think you won over me lol HKprogram 48 — 4y
0
Thanks!!! Galaxybombboy 134 — 4y
0
Oh. Also i know i posted this a long time ago but i wanted to bring up the 'objects are unable to cast animations' i had put a humanoid and humanoid root part into it so it could do animations lol. Wasnt a good choice xD Galaxybombboy 134 — 3y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You should Not Use "Wait For Child" And instead Create a new animation Cuz theres no way you will find animation. Do like this:

local animation = Instance.new("Animation") -- Creates new animation track to The Coin.
local Humanoid = game.Players.LocalPlayer.Character.Humanoid -- Should Find character With humanoid
animation.AnimationId = "WriteAnimationIdHere"
local animationTrack = Humanoid:LoadAnimation(animation) -- load animation with Humanoid

animationTrack:Play() -- When it will play

It should work in LocalScript. Else try in serverscript

Answer this question