I'm trying to make a part that orients itself to face the camera at all times, and I could use some help with this.
local part = game.Workspace.InnerRing local camera = game.Workspace.Camera game:GetService("RunService").RenderStepped:connect(function() local campos = camera.CFrame.p part.CFrame = CFrame.Angles(math.atan2(campos.Z,campos.Y),0,math.atan2(campos.Z,campos.X)) wait() end)
It works fine if I leave the y and z values at zero, so that the x rotation matches my camera perfectly, but when I start to plug in values for z or y, the whole thing becomes wonky.
What am I doing wrong?
It's really easy.
local part = game.Workspace.InnerRing local camera = game.Workspace.Camera game:GetService("RunService").RenderStepped:connect(function() local campos = camera.CFrame.p part.CFrame = CFrame.new(part.Position, Vector3.new(campos.X,Part.Position.Y,campos.Z)) wait() end)
That should work tell me if it doesn't.
Edit: I changed it so that on the 2nd position it gets the cameras position on the X and Z, but then it gets the part's Y so it isn't changing the Y.