Ive made a local script with the code in it, with the animation parented to it, I am trying to animate a turtle with a humanoid in it and it's rigged with the animation ready to go.
local window = game.Workspace.window local animation = script.Animation local humanoid = game.Workspace.Turtle.Humanoid local ez = humanoid.Animator:LoadAnimation(animation) local debounce = false local function clicked() if not debounce then humanoid:WaitForChild("Animator"):LoadAnimation(animation) wait(2) animation:Play() print("hello world!") wait(2.04) window:Destroy() debounce = true end end game.Workspace.Turtle.Button.Touched:Connect(clicked)
this gives me no print message either, so im pretty stumped I have no clue yet what making a function local or not local does, but I've tried both to no avail
--updated code to match what I thought, added animator to humanoid aswell.
Humanoid:LoadAnimation
use Humanoid.Animator:LoadAnimation
as of here: https://devforum.roblox.com/t/deprecating-loadanimation-on-humanoid-and-animationcontroller/857129Off of that now, why would you dupe this for nothing tho?
local ez = humanoid:LoadAnimation(animation)
line 4
humanoid:LoadAnimation(animation)
line 8
Fixed code:
local window = game.Workspace.window local animation = script.Animation local humanoid = game.Workspace.Turtle.Humanoid local debounce = false function clicked() if not debounce then humanoid:WaitForChild("Animator"):LoadAnimation(animation) wait(2) ez:Play() print("hello world!") wait(2.04) window:Destroy() debounce = true end end game.Workspace.Turtle.Button.Touched:Connect(clicked)
I just need to use my own knowledge instead of using a tutorial. so I have gotten this to work.