Why is my gun acting weirdly?

I believe i see the problem your using tool.Activated which fires when a player clicks the Left mouse button while the tool is Equipped use tool.Equipped

I did but the same thing happens

did you set the animation priority to idle

yes idle,Action,Core,Movement.

still the same thing.

did you try what @starnova224 said

Did you set the Animation to loop?
Also im pretty sure something about :LoadAnimation() was depreciated recently that could be the cause of the problem ill see if i can find it

Edit: found it

Also check the Animation and see if you set its Id

ok , so the code sample is

ocal function playAnimationFromServer(character, animation)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		-- need to use animation object for server access
		local animator = humanoid:FindFirstChildOfClass("Animator")
		if animator then
			local animationTrack = animator:LoadAnimation(animation)
			animationTrack:Play()
			return animationTrack
		end
	end
end

“need to use animation object for server access” Animation object? I’m sorry if this answer is really obvious its really late and this is new stuff and i’ve been looking for a clue for multiple hours.

dont go instantly to rescripting your stuff :LoadAnimation() still works there are just better alternatives at the moment
Try checking if the Animation has an Id

the animation does have an Id, and im not getting any errors from my script.

–X

after a bit of testing i think :LoadAnimation() doesnt work anymore i dont know why
But try looking at the Animator class
i havent had to work with animators so im just as in the dark as you

Edit: For some reason now its working no changes just started working

oh ok, thanks anyway

Edit: oh ok…
signed,

X

This is wierd but try this

Tool.Equipped:Connect(function()
    local Human = Tool.Parent:FindFirstChildWhichIsA("Humanoid")
    if not Human then
        Human = Tool.Parent:WaitForChild("Humanoid")
    else
       local AnimationTrack = Human:LoadAnimation(Animation)
       AnimationTrank:Play()
    end
end)

Also is this a Local Script or Server Script?

its a local script.

signed,
–X

try using it in a Server Script thats what i used and it worked(Although it should work from a local script)

I just realized You have the Animation set to Idle

Try setting it to movement or action if that doesnt work ive got nothing

It seems to me like you’re animating a gun rig, but never attaching it to the character at run-time… I’m pretty sure you need to attach BodyAttach to your character somehow, I don’t know how your rig is meant to be used, but you definitely need to do this, also - since you’re using a tool, you need to remove the RightGrip weld in the character’s RightHand!!

is there any errors? also it may be because your using the activated function, not the equipped function, activated is fired when you click while holding the tool and equipped is fired when you equip the tool

Any animation using conventional tools will be over ridden. To add on load animation is deprecated and should use the new animator instead. To add on to that you want to be using the body attach method in which you use motor 6ds to attach the gun to the player instead of using conventional animations in which you would see in older roblox games. How to animate Tool Parts (Guns, Knifes etc.)

load animations directly in animator, and not in humanoid