Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

-- 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

2 comments

0

I'm quite new to scripting, would I put this in a ServerScript located in Workspace?

0

You would put this in your local player

This discussion is preserved as it was. New answers, comments, and votes are closed.