Greetings, I’m using a modified version of @rokoblox5’s viewmodel script (FPS using ViewModels (The improved version) // Parts: 2 out of 3), and he expects us for FPS mode to always be active, however I’m trying to make it toggleable, the biggest problem I have currently, is that animations only play if they are played while the viewmodel is active. How would I go about doing this?
Video of the problem:
(Notice how the arm only extends forward when the gun is equipped while FPS mode is active.)
Code where (I think) the problem is
Humanoid.Animator.AnimationPlayed:Connect(function(AnimationTrack)
if ViewmodelUseRobloxAnimations == false then
if AnimationTrack:GetAttribute("ViewmodelAnimation") ~= true then
return
end
end
if not LoadedAnimations[AnimationTrack] then
LoadedAnimations[AnimationTrack] = ViewmodelHumanoid:FindFirstChild("Animator"):LoadAnimation(AnimationTrack.Animation)
end
end)
local function AnimationUpdate()
for i, v in pairs(LoadedAnimations) do
if i.IsPlaying ~= v.IsPlaying then
if i.IsPlaying then
v:Play()
else
v:Stop()
end
end
v.TimePosition = i.TimePosition
v:AdjustWeight(i.WeightCurrent, 0)
end
end