Hey I want rotate the camera around the humanoidrootpart 90° degree when the player types “Q” but how can I do that?
This picture should help you
This is my script:
local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
hmrp = Character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
camera.CFrame = CFrame.new(math.rad(0 + math.rad(90),0,0)) * hmrp.CFrame
end
end)
local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
hmrp = Character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
camera.CFrame = CFrame.Angles(math.rad(0 + math.rad(90),0,0)) * hmrp.CFrame
end
end)
New Edit but still doesnt work
Part of the issue here is that the camera needs to be set to a scriptable state. Also, the camera has to be updated in a RenderStep, as it won’t always stay rotated. That means it has to repetitively be set to a certain angle, vertical, or horizontal offset. Let me see if I can do this for you.
local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
hmrp = Character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local HORIZONTAL_OFFSET = 10
local VERTICAL_OFFSET = 4
local ANGULAR_INDEX = 0
game:GetService("RunService").RenderStepped:Connect(function()
if hmrp then
camera.CFrame = hmrp.CFrame * CFrame.Angles(0, math.pi * (ANGULAR_INDEX * 0.5), 0)
camera.CFrame *= CFrame.new(0, VERTICAL_OFFSET, HORIZONTAL_OFFSET)
camera.CFrame = CFrame.new(camera.CFrame.Position, hmrp.Position)
end
end)
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
ANGULAR_INDEX += 1
end
end)
EDIT: I’m going to test this rn and fix the bugs
EDIT 2: The code is revised, have a look and test it out
3 Likes
I dont know but it doesnt seem work where do I have to put your script?
Put this script in StarterCharacterScripts

Also make sure to copy and paste the new code I edited at the top
I dont know but it doesnt seem work
Edit: Line 3 has some problems
That’s odd, there doesn’t seem to be an error for me.
I’ll link you the file to the place:
Camera.rbxl (21.9 KB)
If you need a place link, you can test it or copy the place here:
Oh no I understood everything. Thanks 
1 Like