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

How to get one part to face another part?

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

kinda similar to my question that got answered yesterday

look at it Here

1 comment

0

Alright, thanks that helps alot!

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