Hi, I have a camera script which uses Enum.CameraType.Scriptable. I tried setting the camera mode to LockFirstPerson with script and StarterPlayer, but it wont work. Anyway to recreate camera mode with Scriptable? Or changing the camera settings with the ability to set cframe with locking?
Here is the code by the way:
local Camera = workspace.CurrentCamera
local Player = game.Workspace.Player
local Mouse = game.Players.LocalPlayer:GetMouse()
local Sensitivity = 16.5
local OldMousePosition = {Mouse.X,Mouse.Y}
Mouse.Move:Connect(function()
Player.Camera.Orientation += Vector3.new((Mouse.Y-OldMousePosition[2])*-1.6,(Mouse.X-OldMousePosition[1])*-1,0)/Sensitivity
OldMousePosition = {Mouse.X,Mouse.Y}
end)
while wait() do
Camera.CFrame = Player.Camera.CFrame
Camera.CameraType = Enum.CameraType.Scriptable
end
First person gameplay. I am trying to make my own camera script, not using the roblox one. But I want to get rid of the roblox cursor and stop it from going offscreen. Anyway to make it stay in the middle or not go offscreen?
CameraType is used for setting the camera to fixed, scriptable, or custom. CameraMode is setting it to LockFirstPerson. You were trying to use CameraType to do CameraModes job.
local player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
This is all I used in the script and it worked perfectly, as for why the move.move doesn’t work I am not entirely sure. Also, when locking first person, make sure to set it from the player and not the camera. The camera can’t lock first person, but from the player, it can.
I could be entirely wrong, but from what I gather, this is what happened.
Yeah the problem was that when using a Scriptable camera the player can still move there mouse normally. CameraMode serves no function on Scriptable camera types.
The mouse behaviour and Input.Delta was what I was looking for. Thanks.