Also posted here: https://github.com/Anaminus/roblox-bug-tracker/issues/515
If a SpawnLocation is added to the DataModel, but not initially parented to the Workspace (or its descendants), then players will not spawn there. It will have to be removed from the DataModel and then moved directly to the Workspace to be considered valid.
local spawn = Instance.new("SpawnLocation")
spawn.Anchored = true
spawn.Parent = game:GetService("ServerStorage")
spawn.Parent = workspace
-- players will not spawn here
spawn.Parent = nil
spawn.Parent = workspace
-- now players will spawn here
This is an annoying bug because SpawnLocations loaded via InsertService are initially parented to a Model in InsertService, so if they are reparented to the workspace, players will not spawn at them:
local model = game:GetService("InsertService"):LoadAsset(id)
print(model.Parent)
--> InsertService
model.SpawnLocation.Parent = workspace
-- players will never spawn on this spawn
My guess is the code for registering spawns looks something like this:
game.DescendantAdded:connect(function(instance)
if instance:IsA("SpawnLocation") and instance:IsDescendantOf(workspace) then
table.insert(spawns, instance)
end
end)
game.DescendantRemoving:connect(function(instance)
if instance:IsA("SpawnLocation") then
table.remove(spawns, instance)
end
end)