Hello. I’m trying to recreate the camera in the game Foxhole (If you haven’t heard of it search it up, it’s pretty cool). Anyways I’m trying to create the function to rotate the camera. All my current tries of adding CFrame.Angles(0,math.deg(45),0) to the new CFrame coordinate just makes the camera glitch. Anything to help would be appreciated.
My code
local Plr = game.Players.LocalPlayer
repeat wait()
until Plr.Character:FindFirstChild('Head')
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraType = Enum.CameraType.Scriptable
local TS = game:GetService("TweenService")
local RS = game:GetService('RunService')
local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0)
local Head = Plr.Character:WaitForChild("Head")
while true do
local Rotation = script.Rotation.Value
local Distance = script.Distance.Value
local tween = TS:Create(Camera, tweenInfo, {CoordinateFrame = CFrame.new(Vector3.new(Head.Position.X - script.TopDownValue.Value, Head.Position.Y + Distance, Head.Position.Z + Rotation), Vector3.new(Head.Position.X + 10, Head.Position.Y, Head.Position.Z))})
tween:Play()
RS.Stepped:Wait()
end
Video of what the code does:
Tl;dr
How do I make it possible to rotate the camera so it’s facing a new direction? Either using UserInputService or the head LookVector. Looking for specific help for the rotation.
Thanks in advance