So I have this script
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local aimingAnim = Instance.new("Animation")
aimingAnim.AnimationId = "rbxassetid://94679025189997"
local aimingTrack = animator:LoadAnimation(aimingAnim)
local userInput = game:GetService("UserInputService")
-- Start animation when RMB is held
userInput.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
if not aimingTrack.IsPlaying then
aimingTrack:Play()
aimingTrack.Looped = true -- Ensures animation stays playing
end
end
end)
-- Stop animation when RMB is released
userInput.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
if aimingTrack.IsPlaying then
aimingTrack:Stop()
end
end
end)
The script is written with AI so I would like to rewrite the entire thing
so right now It just switches to the hipfire animation while its aiming and I would like for it to have two different animations one with it firing normally and another animation playing while holding down mouse button 2