Need Help With Disabling Camera Movement

-- Place this script in StarterPlayer > StarterPlayerScripts

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local sensitivity = 0.1  -- Adjust the sensitivity to your preference

local function onRenderStep()
    local mouseDelta = player:GetMouse().Delta
    local rotateY = CFrame.Angles(0, math.rad(-mouseDelta.x * sensitivity), 0)
    local rotateX = CFrame.Angles(math.rad(-mouseDelta.y * sensitivity), 0, 0)

    camera.CFrame = camera.CFrame * rotateX * rotateY
end

RunService.RenderStepped:Connect(onRenderStep)

it doesnt seem to be working for some reason. I put the script in a local script inside of starterplayerscripts but i can still move my camera normally

I know this i dont i know why do reson post script

If your isometric camera otherwise works as you’d like, do remember that if you name the LocalScript containing its code to CameraScript and place it inside StarterPlayerScripts, it would allow you to disable the default camera logic which will prevent players from rotating or zooming the camera

That will camera movements zoom

This should do the trick

local RunService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")


local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

local StationaryCam = Instance.new("Part")
StationaryCam.Name = "StationaryCam"
StationaryCam.Anchored = true
StationaryCam.CanCollide = false
StationaryCam.Transparency = 1
StationaryCam.Parent = character:WaitForChild("HumanoidRootPart")

RunService.RenderStepped:Connect(function()
	StationaryCam.Position = HumanoidRootPart.Position
	camera.CFrame = StationaryCam.CFrame * CFrame.new(0, 5, 10) * CFrame.Angles(math.rad(-20), 0, 0)
	-- customise this however you want
end)

If I understand you correctly, then yes it would also disable the ability for players to zoom the camera unfortunately so OP will need to add it back to their camera system if they wish

when i did that it stopped working. Right now it’s in startercharacterscripts named CameraScript, but when i put it into starterplayer scripts it stopped working

Yeah they will better away think about

1 Like

How does the script look like at the moment?

would this be a separate localscript?

You can but if you want it organised it should be in one local script, just test it out

You accidentally wrote Enum, instead of Enum. in the SetListener method for SoundService which is why it’s underlined red

i changed it to Enum. but it still didnt work

It’s quite odd that the script stopped working when you placed it into StarterPlayerScripts

See if removing the line where you set the CameraType to custom fixes that problem

still didnt work, but i have an idea. Is there any way to set the camera sensitivity?

1 Like

This should be helpful to do that:

works perfect. Thank you so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.