I corrected it but anyways here is it Camera | Roblox Creator Documentation
also i’m not completely sure if this would work in this case but you could try or else I could look with a solution using CFrame
He’s probably be better off creating different BasePart instances which represent cameras and then setting the “CameraSubject” property of the “Camera” instance to those proxy cameras.
local char = script.Parent
local root = char:WaitForChild(“HumanoidRootPart”)
local cam = workspace.CurrentCamera
local Cam2 = workspace.Cam2
local customCameraEnabled = false;
local function enableCustomCamera()
char.HumanoidRootPart.CFrame *= CFrame.Angles(0,math.rad(-180),0)
customCameraEnabled = true
game:GetService(“RunService”):BindToRenderStep(“SideCamera”, 201, function()
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(root.Position + Vector3.new(-10,3,0), root.Position)
end)
end
local function disableCustomCamera()
customCameraEnabled = false
cam.CameraType = Enum.CameraType.Custom
game:GetService(“RunService”):UnbindFromRenderStep(“SideCamera”)
end
–[[
Checks if the player is in a custom room (standing on the custom part)
@returns {Part|nil}
]]
local function isPlayerInCustomRoom()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Whitelist
params.FilterDescendantsInstances = {Cam2}
local result = workspace:Raycast(root.Position, Vector3.new(0,-10,0), params)
if (result) then
return true
end
return false
end
while wait() do
if (isPlayerInCustomRoom()) then
if (not customCameraEnabled) then
enableCustomCamera()
end
else
if (customCameraEnabled) then
disableCustomCamera()
end
end
end
Script 2:
local char = script.Parent
local root = char:WaitForChild(“HumanoidRootPart”)
local cam = workspace.CurrentCamera
local partThatChangesStuff = workspace.cameraChangerPart
local customCameraEnabled = false;
local function enableCustomCamera()
customCameraEnabled = true
game:GetService(“RunService”):BindToRenderStep(“topDownCamera”, 201, function()
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(root.Position + Vector3.new(5,0,0), root.Position)
end)
end
local function disableCustomCamera()
customCameraEnabled = false
cam.CameraType = Enum.CameraType.Custom
game:GetService(“RunService”):UnbindFromRenderStep(“topDownCamera”)
end
–[[
Checks if the player is in a custom room (standing on the custom part)
@returns {Part|nil}
]]
local function isPlayerInCustomRoom()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Whitelist
params.FilterDescendantsInstances = {partThatChangesStuff}
local result = workspace:Raycast(root.Position, Vector3.new(0,-20,0), params)
if (result) then
return true
end
return false
end
while wait() do
if (isPlayerInCustomRoom()) then
if (not customCameraEnabled) then
enableCustomCamera()
end
else
if (customCameraEnabled) then
disableCustomCamera()
end
end
end
local char = script.Parent
local root = char:WaitForChild("HumanoidRootPart")
local cam = workspace.CurrentCamera
local partThatChangesStuff = workspace.cameraChangerPart
local customCameraEnabled = false;
local function enableCustomCamera()
customCameraEnabled = true
game:GetService("RunService"):BindToRenderStep("topDownCamera", 201, function()
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(root.Position + Vector3.new(5,0,0), root.Position)
end)
end
local function disableCustomCamera()
customCameraEnabled = false
cam.CameraType = Enum.CameraType.Custom
game:GetService("RunService"):UnbindFromRenderStep("topDownCamera")
end
--[[
* Checks if the player is in a custom room (standing on the custom part)
* @returns {Part|nil}
]]
local function isPlayerInCustomRoom()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Whitelist
params.FilterDescendantsInstances = {partThatChangesStuff}
local result = workspace:Raycast(root.Position, Vector3.new(0,-20,0), params)
if (result) then
return true
end
return false
end
while wait() do
if (isPlayerInCustomRoom()) then
if (not customCameraEnabled) then
enableCustomCamera()
end
else
if (customCameraEnabled) then
disableCustomCamera()
end
end
end
Script 2:
local char = script.Parent
local root = char:WaitForChild("HumanoidRootPart")
local cam = workspace.CurrentCamera
local Cam2 = workspace.Cam2
local customCameraEnabled = false;
local function enableCustomCamera()
char.HumanoidRootPart.CFrame *= CFrame.Angles(0,math.rad(-180),0)
customCameraEnabled = true
game:GetService("RunService"):BindToRenderStep("SideCamera", 201, function()
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(root.Position + Vector3.new(-10,3,0), root.Position)
end)
end
local function disableCustomCamera()
customCameraEnabled = false
cam.CameraType = Enum.CameraType.Custom
game:GetService("RunService"):UnbindFromRenderStep("SideCamera")
end
--[[
* Checks if the player is in a custom room (standing on the custom part)
* @returns {Part|nil}
]]
local function isPlayerInCustomRoom()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Whitelist
params.FilterDescendantsInstances = {Cam2}
local result = workspace:Raycast(root.Position, Vector3.new(0,-10,0), params)
if (result) then
return true
end
return false
end
while wait() do
if (isPlayerInCustomRoom()) then
if (not customCameraEnabled) then
enableCustomCamera()
end
else
if (customCameraEnabled) then
disableCustomCamera()
end
end
end