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)
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)
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