When Equip animation plays, there’s a bounce back at the beginning of the animation. I found solve, but i don’t know how to do it. I want to make the equip animation play first, and when Equip Anim ends Idle Animation plays. When Equip Anim is played, the Idle anim prevents the Equip animation from playing normally
robloxapp-20240323-1535136.wmv (1.2 MB)
like this but for Fe Gun Kit 2 Viewmodel by Thienbao2109
Tool.Equipped:Connect(function()
track:Play()
track.Stopped:Wait() -- needed change
track2:Play()
end)
--Viewmodel
Viewmodel = viewmodelFunction:Invoke("SetUpViewmodel", Tool.Name)
FakeCamera = Viewmodel.PrimaryPart:FindFirstChild("FakeCamera") --If "FakeCamera" Motor6D parents outside viewmodel's PrimaryPart (HumanoidRootPart), consider changing this
VMHandleToFire = Viewmodel:FindFirstChild(CurrentModule.Handles[CurrentVariables.HandleIndex], true)
for i, v in ipairs(AnimationFolder:GetChildren()) do
local VMAnimTable = {}
local FirstPerson = v:WaitForChild("FirstPerson")
if SettingModules[i].VMEquippedAnimationID ~= nil then
VMAnimTable.VMEquippedAnim = FirstPerson:WaitForChild("VMEquippedAnim")
VMAnimTable.VMEquippedAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMEquippedAnim)
end
if SettingModules[i].VMIdleAnimationID ~= nil then
VMAnimTable.VMIdleAnim = FirstPerson:WaitForChild("VMIdleAnim")
VMAnimTable.VMIdleAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMIdleAnim)
end
if #SettingModules[i].VMFireAnimations > 0 then
local VMFireAnimFolder = FirstPerson:WaitForChild("VMFireAnimations")
VMAnimTable.VMFireAnims = {}
for ii, vv in ipairs(SettingModules[i].VMFireAnimations) do
if vv.VMFireAnimationID ~= nil then
local Anim = VMFireAnimFolder:WaitForChild("VMFireAnim_"..ii)
table.insert(VMAnimTable.VMFireAnims, {Viewmodel:WaitForChild("Animation"):LoadAnimation(Anim), vv.VMFireAnimationSpeed})
end
end
Variables[i].TotalVMFireAnimIndexes = #VMAnimTable.VMFireAnims
end
if #SettingModules[i].VMShotgunPumpinAnimations > 0 then
local VMShotgunPumpinAnimFolder = FirstPerson:WaitForChild("VMShotgunPumpinAnimations")
VMAnimTable.VMShotgunPumpinAnims = {}
for ii, vv in ipairs(SettingModules[i].VMShotgunPumpinAnimations) do
if vv.VMShotgunPumpinAnimationID ~= nil then
local Anim = VMShotgunPumpinAnimFolder:WaitForChild("VMShotgunPumpinAnim_"..ii)
table.insert(VMAnimTable.VMShotgunPumpinAnims, {Viewmodel:WaitForChild("Animation"):LoadAnimation(Anim), vv.VMShotgunPumpinAnimationSpeed})
end
end
Variables[i].TotalVMShotgunPumpinAnimIndexes = #VMAnimTable.VMShotgunPumpinAnims
end
if SettingModules[i].VMShotgunClipinAnimationID ~= nil then
VMAnimTable.VMShotgunClipinAnim = FirstPerson:WaitForChild("VMShotgunClipinAnim")
VMAnimTable.VMShotgunClipinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMShotgunClipinAnim)
end
if SettingModules[i].VMReloadAnimationID ~= nil then
VMAnimTable.VMReloadAnim = FirstPerson:WaitForChild("VMReloadAnim")
VMAnimTable.VMReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMReloadAnim)
end
if SettingModules[i].VMHoldDownAnimationID ~= nil then
VMAnimTable.VMHoldDownAnim = FirstPerson:WaitForChild("VMHoldDownAnim")
VMAnimTable.VMHoldDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMHoldDownAnim)
end
if SettingModules[i].TacticalReloadAnimationEnabled and SettingModules[i].VMTacticalReloadAnimationID ~= nil then
VMAnimTable.VMTacticalReloadAnim = FirstPerson:WaitForChild("VMTacticalReloadAnim")
VMAnimTable.VMTacticalReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMTacticalReloadAnim)
end
if SettingModules[i].InspectAnimationEnabled and SettingModules[i].VMInspectAnimationID ~= nil then
VMAnimTable.VMInspectAnim = FirstPerson:WaitForChild("VMInspectAnim")
VMAnimTable.VMInspectAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMInspectAnim)
end
if SettingModules[i].ShotgunReload and SettingModules[i].PreShotgunReload and SettingModules[i].VMPreShotgunReloadAnimationID ~= nil then
VMAnimTable.VMPreShotgunReloadAnim = FirstPerson:WaitForChild("VMPreShotgunReloadAnim")
VMAnimTable.VMPreShotgunReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMPreShotgunReloadAnim)
end
if SettingModules[i].VMMinigunRevUpAnimationID ~= nil then
VMAnimTable.VMMinigunRevUpAnim = FirstPerson:WaitForChild("VMMinigunRevUpAnim")
VMAnimTable.VMMinigunRevUpAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMMinigunRevUpAnim)
end
if SettingModules[i].VMMinigunRevDownAnimationID ~= nil then
VMAnimTable.VMMinigunRevDownAnim = FirstPerson:WaitForChild("VMMinigunRevDownAnim")
VMAnimTable.VMMinigunRevDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMMinigunRevDownAnim)
end
if SettingModules[i].ChargingAnimationEnabled and SettingModules[i].VMChargingAnimationID ~= nil then
VMAnimTable.VMChargingAnim = FirstPerson:WaitForChild("VMChargingAnim")
VMAnimTable.VMChargingAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMChargingAnim)
end
if SettingModules[i].SelectiveFireEnabled and SettingModules[i].VMSwitchAnimationID ~= nil then
VMAnimTable.VMSwitchAnim = FirstPerson:WaitForChild("VMSwitchAnim")
VMAnimTable.VMSwitchAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMSwitchAnim)
end
if SettingModules[i].BatteryEnabled and SettingModules[i].VMOverheatAnimationID ~= nil then
VMAnimTable.VMOverheatAnim = FirstPerson:WaitForChild("VMOverheatAnim")
VMAnimTable.VMOverheatAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMOverheatAnim)
end
if SettingModules[i].MeleeAttackEnabled and SettingModules[i].VMMeleeAttackAnimationID ~= nil then
VMAnimTable.VMMeleeAttackAnim = FirstPerson:WaitForChild("VMMeleeAttackAnim")
VMAnimTable.VMMeleeAttackAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMMeleeAttackAnim)
end
if Module.AltFire and SettingModules[i].VMAltAnimationID ~= nil then
VMAnimTable.VMAltAnim = FirstPerson:WaitForChild("VMAltAnim")
VMAnimTable.VMAltAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMAltAnim)
end
if SettingModules[i].VMLaserBeamStartupAnimationID ~= nil then
VMAnimTable.VMLaserBeamStartupAnim = FirstPerson:WaitForChild("VMLaserBeamStartupAnim")
VMAnimTable.VMLaserBeamStartupAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMLaserBeamStartupAnim)
end
if SettingModules[i].VMLaserBeamLoopAnimationID ~= nil then
VMAnimTable.VMLaserBeamLoopAnim = FirstPerson:WaitForChild("VMLaserBeamLoopAnim")
VMAnimTable.VMLaserBeamLoopAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMLaserBeamLoopAnim)
end
if SettingModules[i].VMLaserBeamStopAnimationID ~= nil then
VMAnimTable.VMLaserBeamStopAnim = FirstPerson:WaitForChild("VMLaserBeamStopAnim")
VMAnimTable.VMLaserBeamStopAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimTable.VMLaserBeamStopAnim)
end
table.insert(VMAnimations, VMAnimTable)
end
CurrentVMAnimTable = VMAnimations[CurrentFireMode]
CurrentVMFireAnim = #CurrentVMAnimTable.VMFireAnims > 0 and CurrentVMAnimTable.VMFireAnims[CurrentVariables.VMFireAnimIndex][1] or nil
CurrentVMFireAnimationSpeed = #CurrentVMAnimTable.VMFireAnims > 0 and CurrentVMAnimTable.VMFireAnims[CurrentVariables.VMFireAnimIndex][2] or nil
CurrentVMShotgunPumpinAnim = #CurrentVMAnimTable.VMShotgunPumpinAnims > 0 and CurrentVMAnimTable.VMShotgunPumpinAnims[CurrentVariables.VMShotgunPumpinAnimIndex][1] or nil
CurrentVMShotgunPumpinAnimationSpeed = #CurrentVMAnimTable.VMShotgunPumpinAnims > 0 and CurrentVMAnimTable.VMShotgunPumpinAnims[CurrentVariables.VMShotgunPumpinAnimIndex][2] or nil
for _, a in pairs(CurrentVMAnimTable) do
if typeof(a) == "table" then
for _, a2 in pairs(a) do
FindAnimationNameForKeyframe(a2[1], true)
end
else
FindAnimationNameForKeyframe(a, true)
end
end
--
HandleToFire[CurrentFireMode].EquippedSound:Play()
if Module.WalkSpeedRedutionEnabled then
Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution
else
Humanoid.WalkSpeed = Humanoid.WalkSpeed
end
SetCrossSettings(CurrentModule.CrossSize, CurrentModule.CrossSpeed, CurrentModule.CrossDamper)
UserInputService.MouseIconEnabled = false
if CurrentModule.ProjectileMotion then
local VisualEffects2 = VisualEffects
if VisualEffects:FindFirstChild(CurrentModule.ModuleName) then
VisualEffects2 = VisualEffects[CurrentModule.ModuleName]
end
Beam, Attach0, Attach1 = ProjectileMotion.ShowProjectilePath(VisualEffects2.MotionBeam, HandleToFire:FindFirstChild("GunFirePoint"..CurrentFireMode).WorldPosition, Vector3.new(), 3, AddressTableValue(CurrentModule.ChargeAlterTable.Acceleration, CurrentModule.Acceleration))
end
RunService:BindToRenderStep(BindToStepName, Enum.RenderPriority.Camera.Value, function(dt)
--Update crosshair and scope
RenderMouse()
RenderScope()
RenderCrosshair()
--Update camera
RenderCam()
--Update rate
RenderRate(dt)
--Render motion
if CurrentModule.ProjectileMotion then
RenderMotion()
end
--Render cooldown
if CurrentModule.BatteryEnabled then
RenderCooldown(dt)
end
--Render 2D shell
RenderTwoDeeShell(dt)
end)
for _, v in pairs(Keyframes) do
table.insert(KeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
if v[2][keyframeName] then
if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1) then
v[2][keyframeName](keyframeName, Tool)
end
end
end))
end
for _, v in pairs(VMKeyframes) do
table.insert(VMKeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
if v[2][keyframeName] then
if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
v[2][keyframeName](keyframeName, Tool, Viewmodel)
end
end
end))
end
if CurrentAnimTable.EquippedAnim then
CurrentAnimTable.EquippedAnim:Play(nil, nil, CurrentModule.EquippedAnimationSpeed)
end
if CurrentAnimTable.IdleAnim then
CurrentAnimTable.IdleAnim:Play(nil, nil, CurrentModule.IdleAnimationSpeed)
end
if CurrentAnimTable.EquippedAnim then
CurrentAnimTable.EquippedAnim:Play(nil, nil, CurrentModule.EquippedAnimationSpeed)
end
if CurrentAnimTable.IdleAnim then
CurrentAnimTable.IdleAnim:Play(nil, nil, CurrentModule.IdleAnimationSpeed)
end
if CurrentVMAnimTable.VMEquippedAnim then
CurrentVMAnimTable.VMEquippedAnim:Play(nil, nil, CurrentModule.VMEquippedAnimationSpeed)
end
if CurrentVMAnimTable.VMIdleAnim then
CurrentVMAnimTable.VMIdleAnim:Play(nil, nil, CurrentModule.VMIdleAnimationSpeed)
end
local StartTime = os.clock() repeat Thread:Wait() if not CommonVariables.Equipped then break end until (os.clock() - StartTime) >= CurrentModule.EquipTime
if CommonVariables.Equipped then
CommonVariables.ActuallyEquipped = true
end
if CommonVariables.ActuallyEquipped and Module.AutoReload and not CommonVariables.Reloading and (UniversalTable.Ammo > 0 or not (Module.UniversalAmmoEnabled or CurrentModule.LimitedAmmoEnabled)) and CurrentVariables.Mag <= 0 then
Reload()
end
end)
Tool.Unequipped:Connect(function()
OnUnequipping(Tool.Parent == Workspace)
end)
Humanoid.Died:Connect(function()
OnUnequipping(true)
end)
Tool.AncestryChanged:Connect(function()
if not Tool:IsDescendantOf(game) then
OnUnequipping(true)
end
end)```