Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom tool animations (idle , running animations)?

Asked by
Dec_ade 47
4 years ago

Does anybody know how to make a tool with a custom idle and walking/running animation when equipped?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

localScript inside tool:

local tool = script.Parent -- The tool position
local player = game.Players.LocalPlayer
local Equipped = false -- The Bool that will be used later
local humanoid = player.Character:WaitForChild("Humanoid") or player.Character.Humanoid -- The Humanoid
local Idle = script.Parent:FindFirstChild('Idle') or script.Parent.Idle-- Your Animation, be sure to put the ID
local run = script.Parent:FindFirstChild("Run")
local LoadAnim

tool.Equipped:Connect(function()
    if not Equipped and Idle and LoadAnim == nil then
        Equipped = true
        LoadAnim = humanoid:LoadAnimation(Idle)
        LoadAnim:Play()
    end
end)

tool.Unequipped:Connect(function()
    if Equipped then
        Equipped = false
        LoadAnim:Stop()
    end
end)

humanoid.Running:Connect(function()
    if Equipped then
        isIdlePlaying = false
        local Animation = humanoid:LoadAnimation(Run)
    end
end)
0
check if this works, I spent too much time on it AnasBahauddin1978 715 — 4y
0
Thanks! Dec_ade 47 — 4y
Ad

Answer this question