What I’m trying to do is make a camera part rotate towards the mouse. So far I have this:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
while wait() do
workspace.CameraPart.Orientation = Vector3.new(0, mouse.X, 0)
end
Nothing I’ve tried works, anyone got any solutions?
That’s odd, I tried it out myself and it was working for me.
Maybe try this?
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace.CameraPart
mouse.Move:Connect(function()
part.Orientation = Vector3.new(0,mouse.X,0)
end)
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local camera = workspace.CurrentCamera
local camPart = nil -- Your cam part
local rotateAmount = 5
local function enable()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = camPart.CFrame
game:GetService("RunService"):BindToRenderStep("CameraLookAtMouse", Enum.RenderPriority.Camera.Value + 1, function()
camera.CFrame = camPart.CFrame * CFrame.Angles(
math.rad((mouse.Y - mouse.ViewSizeY) / mouse.ViewSizeY * -rotateAmount),
math.rad((mouse.X - mouse.ViewSizeX) / mouse.ViewSizeX * -rotateAmount),
math.rad(0)
)
end)
end
local function disable()
game:GetService("RunService"):UnbindFromRenderStep("CameraLookAtMouse")
camera.CameraType = Enum.CameraType.Custom
end
enable()