I tried making camera look from above, problem is now the player can’t move.
I know where the bug is, i just Don’t know how to fix it.
Video of the bug :
I didn’t put most variables due to readibility concerns. Also there are no other scripts
local distance = 20 --// Change this to how many studs you want it to be above the player's hrp
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 110
runService.RenderStepped:Connect(function()
camera.CFrame = CFrame.new(hrp.Position + Vector3.new(0, distance, 0)) * CFrame.Angles(math.rad(-90), 0, 0) -- Bug
-- When I Don't put * CFrame.Angles(math.rad(-90), 0, 0) i can move but the camera is not looking at the player
end)
I don’t get it. In the video, you moved forward just fine? I also tested the code and it doesn’t break for me.
Are you trying to use the arrow keys to move? If so, the left and right arrow does not move the character, but instead rotates the default camera behavior, but the up and down arrow does.
Yeah, cannot replicate it on my end. Can you show the entire code? This is the only script right, nothing else is interfering with the movement or sinking the ContextActionService?
Does it also not work on a fresh baseplate and on a live server? If it works on a live server, then your studio might just be bugged somehow.
local Players = game:GetService("Players")
local runService = game:GetService("RunService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local distance = 20 --// Change this to how many studs you want it to be above the player's hrp
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 110
runService.RenderStepped:Connect(function()
camera.CFrame = camera.CFrame * CFrame.new(0, distance, 0) * CFrame.Angles(math.rad(-90), 0, 0) -- Bug
end)