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

Dummy facing my player, any help?

I was doing some tests, trying to get this Dummy facing my character, but i only could make it facing the same direction im facing, and i want him facing the opposite (looking at me) any help?

Heres my code:

local root2 = script.Parent:WaitForChild("HumanoidRootPart")

while wait(1) do
	local root = game.Workspace.TrololoMaster42.HumanoidRootPart
	local rotation = root.CFrame - root.Position
	root2.CFrame = rotation + root2.Position
end

Heres my result: https://gyazo.com/801f7d37a6a37478f9d0d65729f12a10

2 comments

0

Multiply the rotation by -1.

0

No result

1 answer

✓ Accepted answer

The second argument of CFrame.new is the position that the instance will point towards:

local root2 = script.Parent:WaitForChild("HumanoidRootPart")

while wait(1) do
    local root = workspace:WaitForChild("TrololoMaster42"):WaitForChild("HumanoidRootPart")
	local lookAt = (root.Position - root2.Position).unit * Vector3.new(1,0,1)
    root2.CFrame = CFrame.new(root2.Position,root2.Position + lookAt)
end

1 comment

0

Thats exactly what i needed! Thanks!

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