The camera is supposed to go back to the player, it doesn’t go back.
I thought camera.CameraType = Enum.CameraType.Custom should change he camera back to the person
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer
local boolValueCutscene = game.Workspace.RemoveCamera
local boolValue = game.Workspace.WitchCutsceneDone
local function printValue(value)
if game.Workspace.WitchCutsceneDone.Value == true then
local cam = workspace.CurrentCamera
local part = workspace.CameraCutsceneCastle1
print("SuccessA")
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = part
cam.CFrame = part.CFrame
end
end
local function cutscenedone()
print ("CutsceneOver")
camera.CameraType = Enum.CameraType.Custom
end
boolValueCutscene.Changed:Connect(cutscenedone)
boolValue.Changed:Connect(printValue)
local function cutscenedone()
print ("CutsceneOver")
camera.CameraType = Enum.CameraType.Custom
end
I think this might be the issue, you might need to set the camera.CameraSubject too to the local humanoid so like this:
local function cutscenedone()
print ("CutsceneOver")
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = player.Character:WaitForChild("Humanoid")
end
If this doesn’t work, the other issue might be this:
local function printValue(value)
if game.Workspace.WitchCutsceneDone.Value == true then
local cam = workspace.CurrentCamera
local part = workspace.CameraCutsceneCastle1
print("SuccessA")
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = part
cam.CFrame = part.CFrame
end
end
end -- Added an extra end for you because in your script doesn't seem to be one
For some reason, you are making a new variable for the currentcamera again? just use the camera variable that you made. so update it to be like this:
local function printValue(value)
if game.Workspace.WitchCutsceneDone.Value == true then
local part = workspace.CameraCutsceneCastle1
print("SuccessA")
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
camera.CFrame = part.CFrame
end
end
end
Actually it might be also because of the boolean values you are using. Try adding this:
local function printValue(value)
if game.Workspace.WitchCutsceneDone.Value == true then
local cam = workspace.CurrentCamera
local part = workspace.CameraCutsceneCastle1
print("SuccessA")
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = part
cam.CFrame = part.CFrame
boolValue = false -- Now it can't run again
end
end
Also these two:
boolValue.Changed:Connect(cutscenedone) -- Changed it.
boolValue.Changed:Connect(printValue)
If none of these four solutions I told you work then idk, cuz i’ve not really seen your game yet.
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer
local boolValueCutscene = game.Workspace.RemoveCamera
local boolValue = game.Workspace.WitchCutsceneDone
local function printValue(value)
if game.Workspace.WitchCutsceneDone.Value == true then
local cam = workspace.CurrentCamera
local part = workspace.CameraCutsceneCastle1
print("SuccessA")
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = part
cam.CFrame = part.CFrame
end
end
local function cutscenedone()
print ("CutsceneOver")
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = player.Character.Humanoid
end
boolValueCutscene.Changed:Connect(cutscenedone)
boolValue.Changed:Connect(printValue)
Hello, Here is my try on fixing your issue + general optimization. If you have any questions, feel free to ask!
--|< Services >|--
local Players = game:GetService("Players");
--|< Variables >|--
local localPlayer = Players.LocalPlayer;
local currentCamera = workspace.CurrentCamera;
local cutsceneActive = workspace:WaitForChild("RemoveCamera");
local witchCutsceneDone = workspace:WaitForChild("WitchCutsceneDone");
local cutscenePart = workspace:WaitForChild("CameraCutsceneCastle1");
--|< Functions >|--
local function onWitchCutsceneDoneChanged()
if witchCutsceneDone.Value then
print("SuccessA");
currentCamera.CameraType = Enum.CameraType.Scriptable;
currentCamera.CameraSubject = cutscenePart;
currentCamera.CFrame = cutscenePart.CFrame;
end
end
local function onCutsceneEnd()
print("CutsceneOver");
currentCamera.CameraType = Enum.CameraType.Custom;
currentCamera.CameraSubject = localPlayer.Character:FindFirstChild("Humanoid");
end
--|< Connections >|--
cutsceneActive.Changed:Connect(onCutsceneEnd);
witchCutsceneDone.Changed:Connect(onWitchCutsceneDoneChanged);
Um I’m kinda confused about what you’re saying but. What I said was that he’s making two seperate variables to get the player’s camera when he can just use one. And that MAY also be the error, not entirely sure though that it is. Pretty sure its the camera subject which is the problem.
Wait, he said it should change the camera back to the person, but he used cam.CFrame = part.CFrame, was that supposed to be in the cutscene or in the player?
If the camera type is changed to custom. The camera will follow the player’s camera subject immediately despite whatever cframe the scriptable camera was set to. However he forgot to set the camera subject. So that’s the issue.