CameraSubject is not humanoid

I wanted to make when you die it shows a GUI and it shows the map after you click respawn the camera subject was supposed to change to your character’s humanoid. Instead, it shows where I died
Script:

script.Parent.play.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.Status.RespawnTime.Value >= 0 then
		
	else
		respawnEvent:FireServer()
		script.Parent.Parent.GameUI.Visible = true
		script.Parent.Visible = false
		script.Parent.Parent.GameUI.Crosshair.Visible = true
		--cam.CameraType = Enum.CameraType.Custom
		wait(1)
		cam.CameraSubject = hum
	end
end)

game.Players.LocalPlayer:WaitForChild("Status"):WaitForChild("RespawnTime"):GetPropertyChangedSignal("Value"):Connect(function()
	if game.Players.LocalPlayer.Status.RespawnTime.Value >= 0 then
		script.Parent.time.Visible = true
		script.Parent.time.Text = "RESPAWN AVAILABLE IN: " .. game.Players.LocalPlayer.Status.RespawnTime.Value .. " seconds."
		if game.Workspace:FindFirstChild("Map") then
			--[[
			repeat wait()
				cam.CameraType = Enum.CameraType.Scriptable
			until cam.CameraType == Enum.CameraType.Scriptable
			cam.CFrame = game.Workspace.Map.SkyWatch.CFrame
			]]
			cam.CameraSubject = game.Workspace.Map.SkyWatch
		end
	else
		script.Parent.time.Text = "READY TO RESPAWN"
	end
end)

Video: - YouTube

If you can help me that would be wonderful!

A few questions which may help fix your issue

  • What’s in your respawnEvent RemoteEvent?
  • What does the gui look like in the explorer?
  • Does the gui have ResetOnSpawn enabled?
  1. It is a remote event that changes the Position of the character
  2. No

I think the issue may be that it’s referencing the old character humanoid? Maybe make it so after the 1 second delay, get the humanoid of the character again and use that? That’s the only thing I really see taht could be what’s going on

Yes I have tried it there is a 1 second delay on the play button function

Nono what I meant is that it ould be that the script is referencing the old character and the old humanoid after respawn as it doesn’t know the new character and humanoid. What does your hum variable contain?

local hum = game.Player.LocalPlayer.Character:WaitForChild(“Humanoid”)

Try this out?

script.Parent.play.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.Status.RespawnTime.Value >= 0 then
		
	else
		respawnEvent:FireServer()
		script.Parent.Parent.GameUI.Visible = true
		script.Parent.Visible = false
		script.Parent.Parent.GameUI.Crosshair.Visible = true
		--cam.CameraType = Enum.CameraType.Custom
		wait(1)
        hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
		cam.CameraSubject = hum
	end
end)
1 Like