I’ve placed many “StarterCharacter” Models in the StarterPlayer class - It’s supposed to make my character spawn as one of the Models.
The problem is that I spawn every time as the same character. It’s like I have Var1, Var2, Var3, Var4 and I always spawn as Var 4 (this is only an example).
I was thinking if the StarterCharacters were constantly destroyed and pasted again from ReplicatedStorage they will change it’s order and I’ll maybe spawn as a different character every time I spawn? With a while loop. But I don’t know how to do that, I’ve tried a couple of times and it didn’t work I’m a beginner into scripting.
You can make an array of all the characters available to spawn with, then pick a random index within the array.
local chars = {Var1, Var2, Var3, Var4}
local charIndex = math.random(1,#chars)
local selectedchar = chars[charIndex] -- will be one randomly chosen char from the array
StarterCharacter isn’t meant to be used this way. You’re only supposed to have one StarterCharacter which you don’t modify at any point in your game. If you find yourself stuck with cases like this, you need to change the overall idea in how you’re going to transform characters into new ones.
Such solutions can be found in the post above mine.