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
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.
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