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

Making a Object face Object2 always backwards?

Trying to make a Object not face backwards when looking at Object2. Is there a way to make the Part not look backwards when facing Part2?

-- Code

enabled = true
local Speed = script.Parent.Speed.Value
local Gun = script.Parent.ViewBlock

while wait(Speed) do
local closest = nil
local dist = script.Parent.Range.Value
local Damage = script.Parent.Damage
for _,bloons in pairs(workspace.Bloons:GetChildren()) do
if bloons then
local mag = (Turret.Position-bloons.Position).magnitude
if mag < dist then
closest = bloons
dist = mag
end
end
end
if closest and enabled then 
	Gun.CFrame = CFrame.new(Gun.Position,closest.Position);

1 answer

✓ Accepted answer

To get a vector you subtract like this

local vec = (Object2Pos-Object1Pos).unit

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