CameraSubject doesnt change when resetting

I’ve had an issue when CameraSubject doesn’t change when resetting. Recently, I just made a flag tech when if you die, the camera subject will switch to the new camera subject, “Tip” (flag’s child), and you had a gui button to appear when you click a button to respawn yourself and camera will change back to normal. BTW, I was tryna find a solution on devforum lol

The script


Humanoid.Died:Connect(function()
	if Player.TeamColor == BrickColor.new("Maroon") then
		for _, Flag in pairs(ReplicatedStorage.FlagStorage:GetChildren()) do
			for _, player in pairs(PlayerList) do
				if player.Character:FindFirstChild(Flag.Name) then
					task.delay(5, function()
						FlagModule:ChangeCamera("Custom", player.Character:FindFirstChild(Flag.Name).Sabre.Tip)
						FlagModule:CreateGui()
					end)
				end
			end
		end
	end
end)

Module script:

function FlagModule:ChangeCamera(cameraType, cameraSubject)
	local CurrentCamera = workspace.CurrentCamera
	repeat task.wait()
		CurrentCamera.CameraType = Enum.CameraType[cameraType]
	until CurrentCamera.CameraType == Enum.CameraType[cameraType]
	CurrentCamera.CameraSubject = cameraSubject
	CurrentCamera.CFrame = cameraSubject.CFrame
end

Video that camerasubject doesnt change after respawn:
Place1 - Roblox Studio (gyazo.com)

1 Like

i have an idea, probably have sever detect the player dying
and then fire event to the client to change the camera subject

It doesn’t work I tried to use fireclient into the same remotevent, ToFlagCamera and then use OnServerEvent to FireClient into ServerEvents and it went same thing

EDIT: I change the cameratype to Watch and it worked pretty well

1 Like

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