local tool = script.Parent
tool.Equipped:Connect(function()
local character = tool.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
local uppercut = humanoid:LoadAnimation(script.Animations)
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
humanoid:UnequipTools()
end)
#Why animation no work
1 messages · Page 1 of 1 (latest)
animtrack:play()?
Some of it didnt paste for some reason
local tool = script.Parent
local animationTrack
tool.Equipped:Connect(function()
local character = tool.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
local uppercut = humanoid:LoadAnimation(script.Animations.uppercut)
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
animationTrack = animator:LoadAnimation(uppercut)
animationTrack.Priority = Enum.AnimationPriority.Action
animationTrack:Play()
humanoid:UnequipTools()
end)
why are you loading it twice thats dum
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end``` dont do this. never do this
heres docs for using animations https://create.roblox.com/docs/animation/using
I found the line it fails at
it fails here
Its says unable to cast value to object
local tool = script.Parent
local animationTrack
tool.Equipped:Connect(function()
local character = tool.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
print("works")
animationTrack = animator:LoadAnimation("uppercut")
print("Works1")
animationTrack.Priority = Enum.AnimationPriority.Action
print("Works2")
animationTrack:Play()
print("Works3")
humanoid:UnequipTools()
print("Works4")
end)
New code the print statements are to find the failure points
look up loadanimation in the docs...
Ah, yes. Loading the animation, "uppercut"
Yeah, just read the docs that guy sent