Hello. I’m making a game with a top view and I need the player to turn behind the cursor. I only managed to implement it when it’s on. I will attach a video and a script to make it clearer
robloxapp-20240630-1339113.wmv (1.8 MB)
local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Primary = Char:WaitForChild(“HumanoidRootPart”)
local Cam = workspace.CurrentCamera
Cam.FieldOfView = 90
local mouse = game:GetService(“Players”).LocalPlayer:GetMouse()
local StudsY = 35
local maxTilt = 2
local function Enable()
Cam.CameraType = Enum.CameraType.Scriptable
game["Run Service"].RenderStepped:Connect(function()
Cam.CFrame = CFrame.new(Primary.Position.X,StudsY,Primary.Position.Z) * CFrame.Angles(math.rad(-90),0,0)
end)
end
game:GetService(“RunService”).RenderStepped:Connect(function()
Cam.CFrame = Cam.CFrame * CFrame.Angles(
math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
0
)
end)
Enable()