I have a beam connecting from the RootRigAttachment
of a character to a part using the following script:
local plr = game.Players.LocalPlayer
local beam = script:WaitForChild("Beam"):Clone()
local function pathToPart(beam, a0, part)
local a1 = part:FindFirstChildOfClass("Attachment")
if a1 then
beam.Attachment0 = a0
beam.Attachment1 = a1
else
warn("No attachment was inserted into "..part:GetFullName())
end
a0.Orientation = Vector3.new(0,0,-90)
end
plr.CharacterAdded:Connect(function(char)
local root = char:WaitForChild("HumanoidRootPart")
local a0 = root:WaitForChild("RootRigAttachment")
pathToPart(beam, a0, workspace:WaitForChild("Part"))
beam.Parent = char
end)
Currently, the beam faces wherever the player’s camera is pointing because the Face Camera option is enabled.
I understand that I could disable Face Camera and adjust the attachment’s orientation. However, if I do this, the beam rotates along with the character. How can I ensure the beam remains horizontal, regardless of the camera’s direction? Below is an image showing what I mean by “horizontal”: