Hello. This is my first post, so be gentle
I am working on a game that introduces a lot of new concepts, and has been a bit confusing for my friends who have tried it. Therefore I have added a tutorial. Unfortunately, for the tutorial to work properly, each player must spawn at dedicated single player area, and work their way to the main arena. I want new players to spawn at these places, with the option to skip tutorial.
I have made 16 tutorial teams, and 16 corresponding spawns. I also wrote a script that should sort players to those teams.
local TUTORIAL_COLORS = {
"Earth green",
"Slime green",
"Bright bluish green",
"Black",
"Deep blue",
"Dark blue",
"Navy blue",
"Parsley green",
"Dark green",
"Teal",
"Smoky grey",
"Steel blue",
"Storm blue",
"Lapis",
"Dark indigo",
"Camo",
}
local tutorialAssignment = {}
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
player.CharacterRemoving:Connect(onCharacterRemoving)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local level = Instance.new("StringValue")
level.Name = "Level"
level.Value = 1
level.Parent = leaderstats
local alignment = Instance.new("StringValue")
alignment.Name = "Alignment"
alignment.Value = "Neutral"
alignment.Parent = leaderstats
local wins = Instance.new("StringValue")
wins.Name = "Wins"
wins.Value = 0
wins.Parent = leaderstats
local pick = math.random(16)
repeat
wait()
local random = math.random(16)
until tutorialAssignment[pick] == nil
print(player.Name .. " is " .. pick)
tutorialAssignment[pick] = player
player.TeamColor = BrickColor.new(TUTORIAL_COLORS[pick])
end
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(function(player)
for index , value in pairs(tutorialAssignment) do
if value == player then
tutorialAssignment[index] = nil
end
end
end)
However it does not work in studio Sometimes 2 players get different team, but they spawn at the same place. Sometimes they just remain on neutral team, and spawn randomly, even though there are no neutral spawns. Is it something to do with the studio (If so how do I test it, without 15 volunteers?), or spawn locations are not reliable, and I should code my own spawn system?