local A=game:GetService("\080\108\097\121\101\114\115")local v=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local Y=v:WaitForChild("\108\105\098")local i=require(Y:WaitForChild("\080\105\122\122\097\065\108\112\097\099\097"))local C=.5 local R=i.GameModule:extend("\067\104\097\114\097\099\116\101\114\072\097\110\100\108\101\114")local function M(A)A.CharacterAdded:Connect(function(v)local Y=v:WaitForChild("\072\117\109\097\110\111\105\100")if Y then Y.CameraOffset=Vector3.new(0,-1.6,0)Y:BuildRigFromAttachments()local v v=Y.Died:Connect(function()v:Disconnect()wait(C)A:LoadCharacter()end)end end)end function R.init(v)A.PlayerAdded:Connect(function(A)M(A)A:LoadCharacter()end)for A,v in pairs(A:GetPlayers())do M(v)v:LoadCharacter()end end return R
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local lib = ReplicatedStorage:WaitForChild("lib")

local PizzaAlpaca = require(lib:WaitForChild("PizzaAlpaca"))

local RESPAWN_TIME = 0.5

local CharacterHandler = PizzaAlpaca.GameModule:extend("CharacterHandler")

local function bindRespawn(player)
    player.CharacterAdded:Connect(function(rig)
        local humanoid = rig:WaitForChild("Humanoid")
        if humanoid then
            humanoid.CameraOffset = Vector3.new(0,-1.6,0)
            humanoid:BuildRigFromAttachments()
            local connection
            connection = humanoid.Died:Connect(function()
                connection:Disconnect()
                wait(RESPAWN_TIME)
                player:LoadCharacter()
            end)
        end
    end)
end

function CharacterHandler:init()
    Players.PlayerAdded:Connect(function(player)
        bindRespawn(player)
        player:LoadCharacter()
    end)

    for _,player in pairs(Players:GetPlayers()) do
        bindRespawn(player)
        player:LoadCharacter()
    end
end

return CharacterHandler