You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
character rotating / orienting towards the camera (not looking up or down though)
What is the issue? Include screenshots / videos if possible!
roblox WOULD normally cover this, but since im using 1 custom line (to make the game look a little better), it doesn’t rotate on its own.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i’ve tried to read the devforum but nothing relevant is showing up since its such a specific issue
local runService = game:GetService("RunService")
runService.RenderStepped:Connect(function()
local character = game.Players.LocalPlayer.Character
local camera = game.Workspace.Camera
if character then
local characterPosition = character.HumanoidRootPart.Position
local cameraPosition = camera.CFrame.Position
local lookVector = Vector3.new(cameraPosition.X, characterPosition.Y, cameraPosition.Z) - characterPosition
local newCFrame = CFrame.lookAt(characterPosition, characterPosition + lookVector)
character:SetPrimaryPartCFrame(newCFrame)
end
end)
local camera = game.Workspace.CurrentCamera
local character = game.Players.LocalPlayer.Character
local head = character:WaitForChild("Head")
local function updateCharacterRotation()
local lookVector = (camera.CFrame.Position - head.Position).Unit
character:SetPrimaryPartCFrame(CFrame.lookAt(head.Position, head.Position + lookVector))
end
updateCharacterRotation()
game:GetService("RunService").RenderStepped:Connect(updateCharacterRotation)