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:
or if you want to see the project file, click here.
Help is appreciated!