Hello, I have created 4 player models hat I want to act as "Default" characters for my game. To try and do this, I set up this script:
local characters
local clone
function onPlayerEntered(player)
characters = math.random(4)
if characters == 1 then
clone = script.StarterCharacter1:Clone()
clone.Name = "StarterCharacter"
clone.Parent = game.StarterPlayer
elseif characters == 2 then
clone = script.StarterCharacter2:Clone()
clone.Name = "StarterCharacter"
clone.Parent = game.StarterPlayer
elseif characters == 3 then
clone = script.StarterCharacter3:Clone()
clone.Name = "StarterCharacter"
clone.Parent = game.StarterPlayer
elseif characters == 4 then
clone = script.StarterCharacter4:Clone()
clone.Name = "StarterCharacter"
clone.Parent = game.StarterPlayer
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)
The problem is that every player has the same character, I want there to be a mix of the 4 characters I have created

1 comment
This is a very simple error with your scipt. the characters = math.random(4) is wrong and should be characters = math.random(1,4)