Help animation script

hello everyone, I made an animation, but when the player starts running, it doesn’t look pretty, you can make it so that when the player used the tool, he stood still, didn’t move at all, even his animation didn’t work, and when he removes the tool, everything comes back

local tool = script.Parent
local IdleAnim = Instance.new("Animation")
IdleAnim.AnimationId = "rbxassetid://14815238328"
local firstTrack 
local plr = game.Players.LocalPlayer

tool.Equipped:Connect(function()
	firstTrack = script.Parent.Parent.Humanoid:LoadAnimation(IdleAnim)
	firstTrack.Priority = Enum.AnimationPriority.Action
	firstTrack.Looped = false
	firstTrack:Play()
	script.Parent.isEquipped.Value = true
	wait(1)
end)

tool.Unequipped:Connect(function()
	if firstTrack then
		firstTrack:Stop()
		script.Parent.isEquipped.Value = false
	end
end)
2 Likes

guys, help me write a script or please help

2 Likes

Do you mean that the animation goes strange when you hold a tool?

2 Likes

Yes, and I want that when a player uses animation, he can’t run and his animation doesn’t work either.

1 Like

Set the animation priority to Action4.

1 Like

is that animation yours? probably a roblox bug if so

1 Like

my animation thought there was an error in the script and so I decided to write on the forum

I did what you said, but it didn’t work, maybe I need to add something to the script?

please help me fix this, the animation is mine, but I want that when the player clicks on the tool, his animation does not work and he cannot walk

guys, please help me fix it I really need it

Hey there. If all you’re trying to do is stop the player from moving or jumping you can use this:

local player = game.Players.LocalPlayer

script.Parent.Equipped:Connect(function(plr)
	player.Character.Humanoid.WalkSpeed = 0
	player.Character.Humanoid.JumpHeight = 0
end)

script.Parent.Unequipped:Connect(function(plr)
	player.Character.Humanoid.WalkSpeed = 16 --Sets back to default walkspeed
	player.Character.Humanoid.JumpHeight = 7.2 --Sets back to default jump height
end)

This would mean the player couldn’t use any animations for jumping or moving.

Can you help make the animation or not?