After switching characters, I can't respawn

I’m trying to make a character selection system, but can’t find out how to fix the respawn.

I did what I always did and went to the forums to find answers, but none worked. I tried to make a respawn script, but now I respawn as my old character.

Code:

setRoleEvent.OnServerEvent:Connect(function(plr, role)
	local roleCharacter = role:FindFirstChild("StarterCharacter"):Clone()
	for _, charScript in pairs(script.CharacterScripts:GetChildren()) do
		charScript.Parent = roleCharacter
		charScript.Enabled = true
	end
	roleCharacter.Name = plr.Name
	roleCharacter.Humanoid:Destroy()
	plr:LoadCharacter()
	plr.Character.Humanoid.Parent = roleCharacter
	plr.Character = roleCharacter
	roleCharacter.Parent = workspace
	for _, gear in pairs(role.Tools:GetChildren()) do
		local invGear = gear:Clone()
		invGear.Parent = plr.Backpack
		local staGear = gear:Clone()
		staGear.Parent = plr.StarterGear
	end
end)

and what the role parameter looks like:
image

or if you want to see the project file, click here.

Help is appreciated!

Maybe your setRoleEvent needs to be included where the Died function is. The Died function triggered when a player respawns.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		player.CharacterAppearanceLoaded:Connect(function(char)
			char.Humanoid.Died:Connect(function()
				wait(game.Players.RespawnTime)
				-- put you script here
			end)	
		end)	
	end)
end)