Hello I want To Move A Players Camera While The Camera Is At Scriptable and its cframe is moving
RunService.RenderStepped:Connect(function()
if sitting and CamSubject~=nil then
Camera.CFrame=CamSubject.CFrame
Camera.CameraType=Enum.CameraType.Scriptable
else
Camera.CameraType=Enum.CameraType.Custom
end
end)
Thank you
check this example script I made, it should work for you, if it doesnt please adjust it to your needs or let me know
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local sitting = true
local CamSubject
local cameraSpeed = 0.1
local function moveCamera(direction)
local cameraCFrame = Camera.CFrame
if direction == "up" then
Camera.CFrame = cameraCFrame * CFrame.new(0, cameraSpeed, 0)
elseif direction == "down" then
Camera.CFrame = cameraCFrame * CFrame.new(0, -cameraSpeed, 0)
elseif direction == "left" then
Camera.CFrame = cameraCFrame * CFrame.new(-cameraSpeed, 0, 0)
elseif direction == "right" then
Camera.CFrame = cameraCFrame * CFrame.new(cameraSpeed, 0, 0)
end
end
RunService.RenderStepped:Connect(function()
if sitting and CamSubject ~= nil then
Camera.CFrame = CamSubject.CFrame
Camera.CameraType = Enum.CameraType.Scriptable
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
moveCamera("up")
elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then
moveCamera("down")
elseif UserInputService:IsKeyDown(Enum.KeyCode.A) then
moveCamera("left")
elseif UserInputService:IsKeyDown(Enum.KeyCode.D) then
moveCamera("right")
end
else
Camera.CameraType = Enum.CameraType.Custom
end
end)
I would like it to move with the mouse tho like ur in a normal camera mode, you move ur camera with the right click