How do i make it

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to make a tool when A player mousebutton1clicks it plays animation

  2. **What is the issue?**When i use .Activated it doesnt work

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes.

1 Like

try this but don’t forget to put the animation path in the animation local animation =

Local Script:

local tool = script.Parent
local animation = -- Animation path
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

tool.Activated:Connect(function()
    local humanoid = character:FindFirstChildWhichIsA("Humanoid")
    local animator = humanoid:WaitForChild("Animator")
   
    if humanoid and animation then
        local animationTrack = animator:LoadAnimation(animation)
       
        animationTrack:Play()
    end
end)

it says Players.mlnitoon2.Backpack.Sword.Script:5: attempt to index nil with ‘Character’ does it have to be local script?

yes it has to be a local script

it errors 13:20:04.521 Unable to cast value to Object - Client - LocalScript:12

can you send image of your explorer


“sword” is the tool im using

sword script

you need to create a animation inside your tool then change the AnimationId property to your animation id and then just change local animation =
to tool:WaitForChild(“AnimationName”)

1 Like

there are no errors but it doesnt work

1 Like