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

How to get one part to face another part?

Asked by
Soliate 80
9 years ago

I've been mucking around with some quick sloppy code trying to get one Part to face another Part, but I haven't seem to be able to get that to happen. I have been reading on the CFrame section on the ROBLOX wiki, I just don't really understand it all that much.

Here's my code;

local p = script.Parent

while wait() do
    local b = script.Parent.Parent.Base.CFrame
    local obj = game.Workspace.Dummy.Head.Position
    local x, y, z = obj.X, obj.Y, obj.Z
    p.CFrame = CFrame.new(b.p + Vector3.new(0, 0.65, 0), Vector3.new(x, 0, z))
end

If someone is able to help explain to me what I'm doing wrong and how exactly CFrame values work, it would be a great help to me.

2 answers

Log in to vote
1
Answered by
Kryddan 261 Moderation Voter
9 years ago

kinda similar to my question that got answered yesterday

look at it Here

0
Alright, thanks that helps alot! Soliate 80 — 9y
Ad
Log in to vote
-2
Answered by 9 years ago

Or you could just Rotate it, Right?

Answer this question