Right now I am currently trying to make a system that finds what type of character you are and then loads the custom character model into the player.
This is what i currently have:
function loadChar(player,CharacterType)
local char = game.ServerStorage.CharacterModels:FindFirstChild(CharacterType)
char.Name = player.Name
local humanoid
for i, child in pairs(char:GetChildren()) do
if child.ClassName == "Humanoid" then
humanoid = child
break
end
end
if not humanoid then
humanoid = Instance.new("Humanoid", char)
end
player.Character = char
char.Parent = game.Workspace
end
This function is called after the character is loaded, CharacterType would be the character that they have saved in data stores.
It does “work” however I am not happy with how it looks, what would be a better way of doing this?
Which does the same thing as your for i,v in pairs() loop. The true parameter in FindFirstChild is a boolean for recursive.
Also, I’m not quite sure because I can’t see the rest of the script, but its possible when declaring ‘char’, you might want to make a clone? of course this depends on how the rest of your system works.