i want to make a game like mad murderer, where everyone spawns as a different StarterCharacter. i've only half been able to complete it, since whenever i do it in a test server, some of the people end up spawning as the same character.
this is the script i used:
local status = game.ReplicatedStorage.Status for i = 4,1,-1 do wait(1) status.Value = "Game starts in "..i - 1 end status.Value = "Game starting!" wait(1.5) local characters = workspace.CharacterModels:GetChildren() local players = game.Players local function setCharacter() wait(.1) for k, player in pairs(game:GetService("Players"):GetPlayers()) do characters = workspace.CharacterModels:GetChildren() local starterplayer = game.StarterPlayer:FindFirstChild("StarterCharacter") wait(.3) local rand = math.random(1, #characters) local character = characters[rand] print(character.BillboardGui:FindFirstChildOfClass("TextLabel").Text) print("-----") character.Parent = game.StarterPlayer character.Name = "StarterCharacter" if starterplayer then if starterplayer ~= character then starterplayer.Name = starterplayer.BillboardGui:FindFirstChildOfClass("TextLabel").Text if #workspace.PrevCharacter:GetChildren() < 1 then starterplayer.Parent = workspace.PrevCharacter else workspace.PrevCharacter:FindFirstChildOfClass("Model").Parent = workspace.CharacterModels starterplayer.Parent = workspace.PrevCharacter end end end if player.Character.Parent == workspace.plrsinGame then player:LoadCharacter() player.Character.Parent = workspace.plrsinGame else player:LoadCharacter() player.Character.Parent = workspace end characters = workspace.CharacterModels:GetChildren() end for i = 1,#characters do print(characters[i].Name) end print("-----") end setCharacter() local players = game.Players:GetChildren() for i = 1,#players do players[i].Character.Parent = workspace.plrsinGame end
if anyone would help, it'd be much appreciated!