I'm trying to make a floating object part in front of the player using the camera's CFrame. Note: I cannot only use an offset from the camera, because I want the floating object to appear flat and as if it were facing the camera directly, this cannot be achieved without using the LookAt parameter of CFrame.new()
Code:
local RunService = game:GetService("RunService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local myCamera = workspace.CurrentCamera
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
RunService.RenderStepped:Connect(function()
local p = myCamera.CFrame.Position+(myCamera.CFrame.LookVector*10)-(myCamera.CFrame.RightVector*8)
part.CFrame = CFrame.new(p,myCamera.CFrame.Position)
end)
How can I stop the object from rotating in the manner showed in this GIF ?

2 comments
I'm not entirely sure, but I THINK you can just make it not adjust to the Y value and it won't do that. (This is a guess, I could be wrong.)
@Its_707 If I don't change the Y value then I have to set it to a specific value. So I'll have to lock it to the character or something. But it's still weird when using an X and Z that is connected to the camera.