GYAZO: https://gyazo.com/6d015c08140025fdff20f7598abace09

That error has been issuing me for a while now, It seems to occour when calling the 'LocalPlayer' in a LocalScript, It only happens on death. It works fine until my character dies, then everything stops working. LocalScripts stop running, other scripts break, ect.

Basing of the error report I assume it has something to do with the character being out of sync since this error occoured just now when I tried accesing the humanoid through a LocalScript.

SOURCE OF ERROR:

local plr = game.Players.LocalPlayer
local m = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:wait()
local eq = false
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
m.KeyDown:connect(function(key)
	if key:byte() == 49 then
		if eq then
			char.Humanoid:UnequipTools()
			eq = false
		else
			local kat = script.Parent.Katana:clone()
			kat.LocalScript.Disabled = true
			wait()
			kat.LocalScript.Disabled = false
		char.Humanoid:EquipTool(kat)
		
		eq = true
		end
		
		
	
	end
	print(key:byte())
end)