Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I point a model towards a part?

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

2 comments

0

By setting the orientation of the Model to face the position of a part.

0

Why does this post has so many likes? Sry if this comment is useless

1 answer

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))

7 comments

0

Are you sure that is how it works?

0

The code you provided seems to only move the entire model.

0

"Entire Model" wdym by that...

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.

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.

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.

0

When he said "It moves my entire model" he should have been more specific as to position or moved by rotation. :/

This discussion is preserved as it was. New answers, comments, and votes are closed.