I have a successful character randomizer between two characters, but I'm trying to make up to 5 characters, but since my brain is smooth, I dont know how to add to my current script:
while wait(0.5) do local CharRound = math.random(1,2)
if CharRound == 1 then game.StarterPlayer:FindFirstChild("StarterCharacter"):Destroy() game.StarterPlayer.Characters.Boy.StarterCharacter:Clone().Parent = game.StarterPlayer print("Character Two selected.") elseif CharRound == 2 then game.StarterPlayer:FindFirstChild("StarterCharacter"):Destroy() game.StarterPlayer.Characters.Girl.StarterCharacter:Clone().Parent = game.StarterPlayer print("Character One selected.") end
end
Anything help. thanks :)
firstly put all your characters into one folder or model and no need to name then all "StarterCharacter"
local characters = (The path to the instance containing your characters) local starterPlayer = game.StarterPlayer while wait(0.5) do local chosen_index = math.random(1,5) local chosen_char = characters:GetChildren()[chosen_index]:Clone() chosen_char.Name = "StarterCharacter" if starterPlayer:FindFirstChild("StarterCharacter") then starterPlayer.StarterCharacter:Destroy() end chosen_char.Parent = starterPlayer end