Cant get cutscene to end

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)
3 Likes

Try telling the client to do that rather than the server.

how do i do that, isn’t it already in local?

Ah, my bad. Try setting the player’s camera to classic as well.

that doesn’t work
through cameratype?

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.

try adding

camera.CameraSubject = player.Character.Humanoid

in the cutscenedone() function?
here’s the code:

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)

Aye so I was right Rony! Ayeeee

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);

Isn’t supposed to be like to get the player camera for example:

--Pretend above this is a camera local and player service
Camera.CFrame = Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")

cuz the post said that they wanted to set the camera back to the camera or something idk
tell me if im incorrect

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.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.