Hello, I need help figuring out these animations, I am trying to play animations on the ViewModel, but upon trying to play them there is a split second where it just doesn’t play anything, causing some where looking transitions. Below is what I mean in a video format
Below is the part of the script associated with the animations
local ItemEquipped = false
local Equipped = nil
function HandleViewmodel(Item, hotbarNumber)
if ItemEquipped then -- We already have something equipped
Unequip(Item, hotbarNumber)
else -- We dont have something equipped
ItemEquipped = true
Equipped = Item
print("Viewmodel weld")
print(Item, hotbarNumber)
local Viewmodel = game.ReplicatedStorage["viewmodel arms"]:Clone()
local Weapon = game.ReplicatedStorage.StoredItems[Item]:Clone()
Weapon.Parent = Viewmodel
Weapon.Handle.Anchored = false
Viewmodel.Parent = game.Workspace.CurrentCamera
Viewmodel.Name = "Viewmodel"
local Weld = Instance.new("Motor6D")
Weld.Name = "HandleWeld"
Weld.Part0 = Viewmodel.Main
Weld.Part1 = Weapon.Handle
local WeldOffset = ItemDataModule[Item].Offsets.Client
Weld.C0 = CFrame.new(WeldOffset.Position) * WeldOffset.Rotation
Weld.Parent = Viewmodel.Main
print("Should have welded correctly I think")
local PartTable = { -- Could make into loop, but this is easier, plus its not like anyone is gonna see this
--Viewmodel
Viewmodel.LSleeve,
Viewmodel.RSleeve,
Viewmodel.Lglove,
Viewmodel.Rglove,
--Left Sleeve Textures
Viewmodel.LSleeve.Texture,
Viewmodel.LSleeve.Texture2,
Viewmodel.LSleeve.Texture3,
Viewmodel.LSleeve.Texture4,
Viewmodel.LSleeve.Texture5,
Viewmodel.LSleeve.Texture6,
--Right Sleeve Textures
Viewmodel.RSleeve.Texture,
Viewmodel.RSleeve.Texture2,
Viewmodel.RSleeve.Texture3,
Viewmodel.RSleeve.Texture4,
Viewmodel.RSleeve.Texture5,
Viewmodel.RSleeve.Texture6,
--Other Viewmodel Parts
Viewmodel["Left Arm"],
Viewmodel["Right Arm"],
}
for i, part in pairs(PartTable) do
part.Transparency = 0
end
local IdleAnimation = Viewmodel.AnimationController.Animator:LoadAnimation(script["Weapon Animations/Sounds"][Equipped].Animations.Idle)
IdleAnimation:Play()
end
end
function Unequip(Item, hotbarNumber)
local Viewmodel = Camera:FindFirstChild("Viewmodel")
local UnequipAnimation = Viewmodel.AnimationController.Animator:LoadAnimation(script["Weapon Animations/Sounds"][Equipped].Animations.Unequip)
UnequipAnimation.Looped = false
local animationController = Camera.Viewmodel.AnimationController
for _, animatable in ipairs(animationController:GetPlayingAnimationTracks()) do
animatable:Stop()
end
UnequipAnimation:Play()
end