Soooo I add before post but its to complicate so I now trying to do now tool that playing animation

so…
before its to complicate and unreadable (complicate for me)
I now trying to do just tool that playing animation i try to use roblox tips

and thats code:

local tool = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")

tool.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		local example = hum:LoadAnimation(script.Animation)
		example:Play()
	end)
end)

btw why my “LoadAnimation” is crossed out?
that look something is wrong that its dont work…

im bad at codding

actual code:

local tool = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")

local example = hum:LoadAnimation(script.Animation)

tool.Activated:Connect(function()
	example:Play()
end)

oh i just see the mouse.button1down dont works

Tool.Activated can solve your problem

Tools have an event called Activated which gets fired whenever the player clicks mouse1 with the tool equipped and animations dont have to be loaded again every time

modified script:

local tool = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")

local example = hum:LoadAnimation(script.Animation)

tool.Activated:Connect(function()
    example:Play()
end)

exampel can or can’t be in activated

i was trying but still dont work

still dont work if i add example outside

What do you mean by it doesnt work please explain what doesn’t work?
If your animation isn’t being played make sure the animation priority is high enough so that no other animation plays on top of it

how to set animation priority on roblox animation editor
image

1 Like

what is high enough to pass the tool idle?

btw thanks i think i choose the lowest
i didnt change it

Action passes it for sure movement might even aswell don’t know for sure since not using the default roblox animation script myself

Try using movement if it doesn’t work change it to action

Core is high?
some test and dots because roblox wants more than 30

Humanoid:LoadAnimation() is deprecated. Use Animator:LoadAnimation() instead. More information on this can be found here.

Now knowing that but thanks for help. i can continue my project.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.