local Tool = script.Parent
local Animation = Tool.Animation
Tool.Activated:Connect(function()
local Character = Tool.Parent
local humanoid = Character.Humanoid
local AnimationTrack = humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
end)
I am not getting any errors in the output. My hierarchy is as follows:
I’ve put my animations ID into the Animation.AnimationId property.
I recommend you to play the animation in a client script.
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local Tool = script.Parent
local Animation = Tool.Animation
Tool.Activated:Connect(function()
AnimationTrack:Play()
end)
local Tool = script.Parent
local Animation = Tool.Animation
local Character
Tool.Activated:Connect(function()
local humanoid = Character:WaitForChild("Humanoid")
local AnimationTrack = humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
print(Character)
end)
I keep forgetting that you need to play animations on the client when using Humanoid:LoadAnimation
I copy pasted your script (into the same server script you saw in the heriarchy) and it still doesn’t work. AnimationId is rbxassetid://6641902258 if that helps at all.
local Tool = script.Parent
local Animation = Tool.Animation
local Character = Tool.Parent
local humanoid = Character:WaitForChild("Humanoid")
local AnimationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(Animation)
Tool.Activated:Connect(function()
AnimationTrack:Play()
end)
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local Tool = script.Parent
local Animation = Tool.Animation
local humanoid = Tool.Parent
Tool.Activated:Connect(function()
local humanoid = Tool.Parent.Humanoid
local AnimationTrack = humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
end)