I want to make viewport frames with the correspending models in the frame, but im not sure how to make the camera face them
this is the replicated storage folder for the models
CFrame.lookAt
There is more optimized way to do that btw but this should be enough for you.
Also please avoid using anonimous functions like in your example unless its a closure.
You also should not use ipairs and pairs anymore as since it does slow down the perfomance and is complitelly unneeded in your example
Also chars :GetChildren() could be cached in outside scope so you be able to loop dirrectly through that.
Not sure why you are putting it inside a function anyway
Please stop saying “don’t use ipairs and pairs” (they’re still very much relevant), it does not impact performance in any way unless you completely disable compiler optimizations manually.
If I’m understanding your question correctly, you want to make the camera of the viewport face the models?
You should be able to just set a constant camera CFrame and move the models to a specific position in the viewport, unless you’re planning to have models of different sizes, in which case, you should look into something like ViewportFrame Model Fitter.
yes, i want to make it so each viewport camera faces their corresponding model, and the models will all be the same size
how could i be able to add a constant camera cframe?
If ipairs and pairs arent needed anymore, what should i use instead?
and im putting it in a function since im going to be using it somewhere else in the script as well and i want to keep it organised
I did that already with the placeholder, but i dont know how i can put the models in the replicated storage in the placeholders position to make it face them instead of it