How to do the viewmodels?

I am making a viewmodel and I am making it so that some hands adapt to all types of weapons, but now I have made it so that when the player equips the weapon quickly clones the ViewModel of a folder and grabs the weapon from the inventory and puts it in the viewmodel but personally I think that it is not so optimized in the case that there are many players, maybe I do ALL in a single viewmodel, but how would I do it? I think that when the weapon is cloned in the viewmodel, I should add the descendants of the weapon in a table so that the moment that the player equips another weapon I delete the descendants that are in the table (the weapon) and the other weapon I clone it in the viewmodel and add it in a table and so on? tell me another way or tell me how I could perfect this?

1 Like

You’re overcomplicating a viewmodel system. Instead of having the weapon attach to existing arms, just have each weapon rig also have the arms. Use base-level arms so that you can change/customize them in runtime.

If you want to optimize the viewmodels, have a viewmodel handler parent all viewmodels to Camera upon initialization, and set all base parts of it anchored and having a transparency of 1. When a viewmodel is “loaded”, just have it go back to the original visibility and only CFrame that one. This method of optimization is called “culling”.

2 Likes

In many games, the client will put the low-quality weapon on other players and the main viewmodel is just for yourself. The weapon is cloned or parented in the viewmodel.

I think you got the rest good.

1 Like

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