I am making a game that requires the camera to be changed a lot. Everything is working fine from the custom camera it made to the security camera system.
There is supposed to be jump scares that I want to make by forcing the player’s camera to a certain position, but for some reason the method i have been using to change cameras no longer works.
The script is supposed to check if a BoolValue is true, and if it is, send the player camera CFrame to a part’s CFrame.
It is a local script, the camera is set to scriptable, and the value is changing as well as being detected by the script
The script is in the value, which is in the workspace, and this is what I have so far:
local Camera = workspace.CurrentCamera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")
Camera.CameraType = Enum.CameraType.Scriptable
while true do
if script.Parent.Value == true then
Camera.CFrame = DeathCam.CFrame
end
wait()
end
local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")
while true do
if script.Parent.Value == true then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = DeathCam.CFrame
Camera.Focus = DeathCam.CFrame
end
wait()
end
hmmm this is odd,
I have one more thing to try, This script removes the loop and just detects when the value changes
local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")
script.Parent.Value.Changed:Connect(function(value)
if value == true then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = DeathCam.CFrame
Camera.Focus = DeathCam.CFrame
end
end)
Local scripts don’t run on the server.
Make a local script in starterplayer scripts:
local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")
local MyBool=workspace.MyBool -- Point to your bool location
local function MoveCamera()
if MyBool.Value==true then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = DeathCam.CFrame
end
end
MyBool.Changed:Connect(MoveCamera)