ViewModel hands in sight before equip animation plays


You can see sometimes the viewmodel hands are just straight for a split second

I don’t have any clue what is the cause of this.

This is when the player equips the weapon:

function module.equip (viewmodel, gun, hold, pullout)
	local GunHandle = gun.GunComponents.Handle
	local Motor6D = viewmodel:WaitForChild("RightArm").Handle

	gun.Parent = viewmodel
        Motor6D.Part1 = GunHandle

	workspace.LocalSounds.cloth1:Play()
	workspace.LocalSounds.equip1:Play()
	local Hold = viewmodel.Humanoid.Animator:LoadAnimation(hold)
	local PullOut = viewmodel.Humanoid.Animator:LoadAnimation(pullout)
	for i,v in pairs(viewmodel.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
	PullOut:Play()
	viewmodel.Parent = workspace.CurrentCamera
	PullOut.Stopped:Wait()
	Hold:Play()
end
2 Likes

Try loading the Animations at the very beginning of the script using ContentProvider.

or

    PullOut:Play()
	viewmodel.Parent = workspace.CurrentCamera
	PullOut.Stopped:Wait()
	Hold:Play()

to

spawn(function()
    PullOut:Play()
	viewmodel.Parent = workspace.CurrentCamera
	PullOut.Stopped:Wait()
	Hold:Play()
end)

putting it on its own thread won’t change anything.

Instead of using ContentProvider you should instead try doing this:

local Hold = viewmodel.Humanoid.Animator:LoadAnimation(hold)
local PullOut = viewmodel.Humanoid.Animator:LoadAnimation(pullout)
for i,v in pairs(viewmodel.Humanoid:GetPlayingAnimationTracks()) do
	v:Stop()
end
PullOut:Play(0)
viewmodel.Parent = workspace.CurrentCamera
PullOut.Stopped:Wait()
Hold:Play()
1 Like

I feel like animation:KeyframeReached would work here.
naming the first keyframe in the animation could potentially allow it to load in and when the function is called make the arms visible.

1 Like

Nope, none of these worked.

The viewmodel is like this when it spawns in:
image

maybe this is connected with the bug>|

edit, your code works. i found out whats wrong with my other code

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.