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

How would I point a model towards a part?

Asked by
KordGamer 155
6 years ago

I've tried to use BodyGyros, but that hasn't worked. What would I have to use? Thanks.

0
By setting the orientation of the Model to face the position of a part. LuckiestJade -5 — 6y
0
Why does this post has so many likes? Sry if this comment is useless Konethorix 197 — 6y

1 answer

Log in to vote
0
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago

http://wiki.roblox.com/index.php?title=CFrame#CFrame.new

http://wiki.roblox.com/index.php?title=API:Class/Model/SetPrimaryPartCFrame

Make sure to define the model's Model.PrimaryPart property, you can do this by using the properties panel, clicking on the Model.PrimaryPart value, and selecting a part by clicking on it in the explorer or in the viewport.

Model:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 50, 0), Vector3.new(0, 0, 0))

0
Are you sure that is how it works? LuckiestJade -5 — 6y
0
The code you provided seems to only move the entire model. KordGamer 155 — 6y
0
"Entire Model" wdym by that... LuckiestJade -5 — 6y
0
Yes, that's how it works. You'd obviously want to maintain the model's position in the first argument to CFrame.new() with that constructor, but it works. Avigant 2374 — 6y
View all comments (3 more)
0
I checked the wiki and I think I know why. The first Vector3 value is the position (Pos) of the model, whereas the second Vector3 value changes the rotation (lookAt) of it. Try changing the second Vector3. Dont know if I’m 100% right though. User#20279 0 — 6y
0
Yes. The point is not to copy and paste an answer's code. The point is to read it, try to understand it, and apply it to you rown situation. This code will position a model at Vector3.new(0, 50, 0), looking at Vector3.new(0, 0, 0), but you should transform it so it applies to your situation. Avigant 2374 — 6y
0
When he said "It moves my entire model" he should have been more specific as to position or moved by rotation. :/ LuckiestJade -5 — 6y
Ad

Answer this question