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

Why doesn't my animation play when the tool is activated?

Asked by 4 years ago

I am trying to play an animation with a tool whenever that tool has been activated. When I try, my animation never plays.

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
local anim = h:LoadAnimation(script.Parent:WaitForChild("Animation"))

script.Parent.Activated:connect(function()
    anim:Play()
end)

This code is Local Script in a tool in the starter pack The animation is a child of the tool and has an ID The animation is 1 second long The animations priority is set to [Action]

0
Try printing something inside of the Activated function and comment out anim:Play() and see if it prints it out. BennyBoiOriginal 293 — 4y
0
Tested the code in studio it worked for me so the script is fine it might be the set up Prestory 1395 — 4y
0
It was because I was using an R16 animation with an R6 only game. I didnt even notice, and I feel really dumb. UGH! DreamInspired 61 — 4y

Answer this question