LookVectors/cframes make no sense to me, so can someone help explain this to me?
COMMUNITY QUESTION
How do I make a brick face the same direction as the player?
2 answers
part.CFrame = CFrame.new(part.CFrame.p, targetCFrame.p)
You can construct a CFrame with two Vector3s. The first one is the position of the part and the second one is the position that you want the part to be facing.
So if you want the part to always be facing the player you would do it like this:
local RunService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local part = Instance.new("Part")
part.Parent = workspace
RunService.RenderStepped:Connect(function()
part.CFrame = CFrame.new(part.Position, character.PrimaryPart.Position)
-- or if you want the part to be facing the same direction the player is facing then you would do this: part.CFrame = CFrame.new(part.Position, part.Position + character.PrimaryPart.CFrame.LookVector)
end)
local Brick = workspace.Part
while true do
wait()
Part.CFrame = CFrame.new(Part.CFrame.p,Game:GetService("Players").devisings.Character.HumanoidRootPart.Position)
end
the first parameter should be the position you want the part, the second parameter is what you want the part to face. in this scenario the parts position will stay fixed, but will constantly be facing you.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
i know i could've used more variables for tidiness
-1 for bad code, events could have been used instead, and you don't answer the question in the body