Equip animation plays, but when the idle animation starts to play, it plays the activate/shoot animation

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to make a gun for my game.

  2. What is the issue? When the idle animation is about to play, the shoot/activate animation plays instead.

  3. What solutions have you tried so far? I already tried to remake the idle animation, and to place the “animator:LoadAnimation()” at another parts of the script.

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local tool = script.Parent
local handle = tool.Handle

local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChild("Animator")

local equip = Instance.new("Animation")
equip.AnimationId = "rbxassetid://13036787364"

local idle = Instance.new("Animation")
idle.AnimationId = "rbxassetid://13036067049"

local shoot = Instance.new("Animation")
shoot.AnimationId = "rbxassetid://13035789417"

local equipTrack
local Idletrack

local actvateTrack
local mouse = plr:GetMouse()

tool.Equipped:Connect(function()
	
	tool.Enabled = false
	
	equipTrack = animator:LoadAnimation(equip)
	equipTrack.Looped = false
	equipTrack.Priority = Enum.AnimationPriority.Movement
	
	Idletrack = animator:LoadAnimation(idle)
	Idletrack.Looped = true
	Idletrack.Priority = Enum.AnimationPriority.Movement
	
	equipTrack:Play()
	
	equipTrack.Ended:Connect(function()
		
		Idletrack:Play()
		
	end)
	
end)

tool.Activated:Connect(function()
	
	actvateTrack = animator:LoadAnimation(shoot)
	actvateTrack.Priority = Enum.AnimationPriority.Movement
	actvateTrack.Looped = false
	
	Idletrack:Stop()
	actvateTrack:Play()
	tool.Sets.Ammo.Value -= 1
	Idletrack:Play()
	
	tool:FindFirstChild("RemoteEvent"):FireServer(mouse.Hit.Position)
	
end)

tool.Unequipped:Connect(function()
	
	if Idletrack and equipTrack then
		
		Idletrack:Stop()
		equipTrack:Stop()
		
	end
	
end)

I don’t have any ideas to fix this, and please do not send me a whole script.
By the way, the script is inside of the gun tool.

Nevermind, it got fixed.
You just need to add a “;” at the “animation:Play()” and “animation:Stop()” thing.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.