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

What's wrong with this animation script? it worked for the yt guy!

ive never worked with animations

script.Parent.MouseButton1Click:Connect(function()
local humnoid = game.Players.LocalPlayer.Character.Humanoid
local anom = humnoid:LoadAnimation(script:findFirstChild('Animation'))
	anom:Play() 
end) --localscript

i really have no idea I even watched a guy on youtube it worked for him but why not for me?

3 answers

You forgot the capital F in :FindFirstChild('Animation').

7 comments

0

it works with the small one too

0

Did you use the youtubers animation when its uncopylocked?

0

If you did, you have to make your own.

0

i used my own

0

Did you create it correctly or did you call it "Animation"?

0

both.

0

Oh I just realized you put humnoid not humanoid.

Like Omq_ItsJazmin said, Humanoid:LoadAnimation() is deprecated.

-- instead of this --

local humanoid = game.Players.LocalPlayer.Character.Humanoid
local anim = humanoid:LoadAnimation()
anim:Play()
-- do this --

local player = game.Player.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")


local Track = humanoid.Animator:LoadAnimation(--Your Animation Instance --)
Track:Play()

So basically Let me explain why you should do this way. The player's character may have not loaded yet, so instead of doing player.Character do player.Character or player.CharacterAdded:Wait() also, :WaitForChild() is extremely important when catching the player's character.

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