I am facing an issue where when I have a script changing the workspace.CurrentCamera property to my custom camera, it gets used by the roblox’s internal PlayerModule.CameraModule core script and I have to listen to the CharacterAdded event to initialize my camera like this:
And whenever the character resets, that core script decides to change back my scriptable camera to default settings and use it as if it belonged to it. How can I disable this behavior of this core script module so that it doesn’t take my camera and take control over it when a new character initializes?
Could do this also as its more efficient and you don’t have to deal with creating the instance,
But your script seems to be fine when i reset, here is my script
local Player = game:GetService("Players").LocalPlayer
local MyCam = Instance.new("Camera")
MyCam.CameraType = Enum.CameraType.Scriptable
MyCam.Name = "MyCam"
MyCam.Parent = workspace
workspace.CurrentCamera = MyCam
Player.CharacterAdded:Connect(function()
local MyCam = workspace:FindFirstChild("MyCam")
MyCam.CameraType = Enum.CameraType.Scriptable
MyCam.Name = "MyCam"
MyCam.Parent = workspace
workspace.CurrentCamera = MyCam
end)
No actually im asking a way so that this behavior could be tackled in a more clean and convenient way rather than just this hacky way, one method I found that is more clean in my opinion is this:
local LocalPlayer = game:GetService("Players").LocalPlayer
local cam = Instance.new("Camera")
cam.Name = "MyCam"
cam.CameraType = Enum.CameraType.Scriptable
cam.Parent = workspace
workspace.CurrentCamera = cam
--ReAdjust Player's Camera
LocalPlayer.CharacterAdded:Connect(function()
cam.CameraType = Enum.CameraType.Scriptable
end)
I think this way would be way more clean as it doesn’t creates new camera instances every time the character loads or re-loads.
But still, if there is a more better approach, please tell.