Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I change the position and orientation of a model in a script?

Asked by
TtuNkK 37
3 years ago

I have a model that I'm trying to use as an ability, but since it's a model, I can't change its position or orientation. I tried using a in pairs loop, and using cframe and cframe angles, but that creates a problem because it would mess up how I want the model to look. Is there anything to solve this problem? Thanks!

2 answers

Log in to vote
0
Answered by
emervise 123
3 years ago

Use something like this:

local model = game.Workspace.model:GetDescendants
model.Position = model.Position + Vector3.new(0,5,0)
0
I have actually not tried this in studio before but it should work. emervise 123 — 3y
0
To change the orientation, use CFrame.Angles() Dovydas1118 1495 — 3y
0
Didn't work. I tried to equal the position to the humanoid position, but it didn't change the position. TtuNkK 37 — 3y
0
You can't set "model"s position because it's an array of multiple instances emervise 123 — 3y
0
Sorry, I'm an idiot. I forgot all about primary parts. Set a primary part in the model and then move the primary part. emervise 123 — 3y
Ad
Log in to vote
0
Answered by
nc2r 117
3 years ago

Use Model:SetPrimaryPartCFrame()

Answer this question