Viewmodel parts randomly dissapear at certain angles

The title, I have a viewmodel rig that contains a base part that is constantly set to the cameras CFrame on the client, and the other parts will be re-positioned with their respective offsets from the base part, here is the code and some images that help explain the situation:

game["Run Service"].RenderStepped:Connect(function()
	script.Parent.Viewmodel:SetPrimaryPartCFrame(game.Workspace.CurrentCamera.CFrame)
	for i,v in pairs(script.Parent.Viewmodel:GetChildren()) do
		if v:IsA("Part") then
			v.LocalTransparencyModifier = 0
		end
	end
end)

image
image
https://gyazo.com/593dc669faa220acf9b7fb6b46d8b90e

As you can see from the gif provided, the viewmodel seems to randomly become invisible, I made sure it wasnt because of some random spikes in position changes, all parts seem to still be there, just not visible, backing this up is the shadows, they cast in their expected spot even when the parts are invisible, any guesses as to why this happens?

Maybe instead of using SetPrimaryPartCFrame just reference the primary part.

Also use GetService, it’s more efficient.

game:GetService("RunService").RenderStepped:Connect(function()

Unsure what you mean by referencing the primary part, as in script.Parent.Viewmodel.Base?

yes

characterlimitasdfghjkhgfdsdfgh

Fairly certain SetPrimaryPartCFrame will auto-update other parts in a model while setting the CFrame directly wont, but I could try that to see if that is still true. Either way, might not be the most obvious solution, I feel the solution to the issue at hand would be a bit more obvious than how I apply my CFrames, because at the end of the day the position would be the same.

Update: setting CFrame directly does work, but does not solve the problem.

What does this mean? Are you using welds or is this code? If it’s code, could we see this too? Might be the problem.

1 Like

Forgot to mention they are rigged with Motor6Ds, the welds in the picture were byproducts of the quick rigging plugin I was using, deleting them did not fix the problem however.

1 Like

So I just moved the base part back and it suddenly works, I guess the parts just randomly got exactly enough out of view to cull at specific angles??? This is such a strange bug, if anybody eventually finds an actual solution, please post it here (if possible), but for now this is what helped me.

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