Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make it to where I can randomize the 'StarterCharacter'?

Asked by
Nump4d 5
4 years ago

I have a folder in ReplicatedStorage named 'StarterChars', I need help making it to where you get a random StarterCharacter when you spawn. Any help would be greatly appreciated.

1 answer

Log in to vote
0
Answered by 4 years ago
-- Clone one of the starter characters into Game.StarterPlayer and rename it to "StarterCharacter" so the first player who joins actually gets set as a starter character.
local StarterCharacters = {
    game.ReplicatedStorage.StarterChars.StarterCharacter1, 
    game.ReplicatedStorage.StarterChars.StarterCharacter2, 
    game.ReplicatedStorage.StarterChars.StarterCharacter3
}

while wait(0.5) do
    if game.StarterPlayer:FindFirstChild("StarterCharacter") then
        game.StarterPlayer.StarterCharacter:Destroy()
    end
    local Randomize = StarterCharacters[math.random(1, #StarterCharacters)]:Clone()
    Randomize.Name = "StarterCharacter"
    Randomize.Parent = game.StarterPlayer
end
0
I'm quite new to scripting, would I put this in a ServerScript located in Workspace? Nump4d 5 — 4y
0
You would put this in your local player assassain098 -5 — 4y
Ad

Answer this question