Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Custom tool animations (idle , running animations)?

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

1 answer

✓ Accepted answer

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)

2 comments

0

check if this works, I spent too much time on it

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.