I'm making this script for my tool but it always breaks this tool is for a walk animation and a tool animation https://gyazo.com/4191090f2d1b97715e144f4068316fa5 gif of what's wrong with the script

local script

local Handle = script.Parent:WaitForChild("Handle")
local Draw = Handle:WaitForChild("Draw")

local Hum = game.Players.LocalPlayer.Character.Humanoid

local Idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Anims.Idle)
local WalkAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Anims.Movement)

script.Parent.Deactivated:Connect(function()
	Idle:Play()
end)

script.Parent.Equipped:Connect(function()
	 local animScript = nil
	animScript = script.Parent.Parent:WaitForChild("Animate")
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "https://roblox.com/asset/?id=6333868507"
	Draw:Play()
	Idle:Play()
end)

Hum.Running:Connect(function(speed)
	wait(0.005)
	if speed > 0 and script.Parent.Equipped then
		Idle:Stop()
		WalkAnim:Play()
	elseif speed > 0 and script.Parent.Unequipped then
		WalkAnim:Play()
		Idle:Stop()
	elseif speed < 0 and script.Parent.Equipped	then
		WalkAnim:Stop()
		Idle:Play()
	elseif speed < 0 and script.Parent.Unequipped then
		WalkAnim:Stop()
		Idle:Stop()
	end
end)

im kinda new to scripting tools and animations so my brain can't solve this

1 comment

0

Imma go offline for a sec