Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why Wont Humanoid:LoadAnimation Work?

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

4 comments

0

Hey why don't you accept my answer

0

Click "Accept Answer" Beside my question and your question will then be viewed as answered

0

Oh, Thanks

0

no problem

2 answers

✓ Accepted answer

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.

3 comments

0

I think you won over me lol

0

Thanks!!!

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.