Animating tools is pretty tricky because they don’t really natively support that to my knowledge, unless you forcefully edit the grip CFrame values. If you want a more reliable solution that depends on the engine, you could attach the gun with a Motor6D and then, on a rig with the gun attached in the same way, animate it alongside your character.
Edit: Consider the reply under mine if you do not want the gun model to move, and just want it to be rotated properly when attached.
This is almost definitely not the correct way to do this. I typically make the animation and then use the Tool Grip Editor plugin by CloneTrooper1019 to edit the orientation of the gun until it looks correct. Just make sure the gun is welded properly
what u would want to do is load (and play) an animation when the player activates the tool. this can easily be done on the client side!
-- pretty basic, but it's only meant to serve as an example
-- no need for remote events, client-side animations replicate automatically
local Players = game:GetService("Players")
--\\ tool & weapon setup
local weapon = script.Parent
local animAssetId = `119021135878993`-- replace with your own id
local function triggerAnimation(plr)
local char = plr.Character
local humanoid = char and char:FindFirstChild("Humanoid")
if humanoid then
local newAnimation = Instance.new("Animation")
newAnimation.AnimationId = (`rbxassetid://{animAssetId}`)
local animTrack = humanoid:LoadAnimation(newAnimation)
animTrack.Priority = Enum.AnimationPriority.Action
animTrack:Play()
end
end
--\\ play animation when player uses the tool
weapon.Activated:Connect(function()
local user = Players:GetPlayerFromCharacter(weapon.Parent)
if user then
triggerAnimation(user)
end
end)