Client Script Won't Get The New Character & Humanoid

I’ve been stuck on this issue for the past hour so far and looked through solutions but still can’t seem to fix this error, so I have a error for my movement system which works perfectly fine but when the player dies then it breaks, I’ve dumbed it down to this area where it is not getting the new character and humanoid because my script checks for the humanoid health and it keeps saying 0 even when i respawn, is there any better way I can check for when the player respawns to set their new character and health?

local MovementController = nil

if Player then
	print("yo")
	local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
	if char then
		Player = game.Players.LocalPlayer
		Character = char
		
		Humanoid = char:FindFirstChild("Humanoid")
		MovementController = MovementManager.New(game.Players.LocalPlayer)
		MovementController:OnSpawn()

		Humanoid.Died:Connect(function()
			MovementController:OnDeath()
		end)
	end

end

i always just set the char to the newest character when player.characterAdded is called

1 Like

I’ve tried using play character added and it has not been going well for me so far it wont do anything :frowning:

Ok Nevermind I have figured it out myself after trial and error

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