--!nocheck

local Player = game.Players.LocalPlayer
local Character = game.Players.LocalPlayer.Character
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") :: Humanoid

local ev

local died = false
function death()
	if died then return end
	died = true
	local gs:ModuleScript = game.Players.LocalPlayer.PlayerScripts.Client.ControlScript.Player.GameSettings
	local gs = require(gs) -- ROBLOX SHUT UPI
	gs.lives -= 1
	
	print("death client")
	game.ReplicatedStorage.Remotes.Respawn:FireServer()
	ev:Disconnect()
end

ev = game:GetService("RunService").RenderStepped:Connect(function()
	if Humanoid.Health <= 0 then
		death()
	end
end)
