I am trying to make it so when 2 players are in the game, maps will be chosen out of the ServerStorage and cloned into workspace and the players will go there. But when I test it, ServerStorage is empty, which causes it to not work. Why does it become empty?
maps = game.ServerStorage:GetChildren()
local player = game:GetService"Players".LocalPlayer
local guis = player:WaitForChild"PlayerGui"
while wait(.5) do
if game.Players.NumPlayers >= 2 then
guis.ScreenGui.Frame.Map.Visible = false
guis.ScreenGui.Frame.Madeby.Visible = false
wait(3)
ranmap = math.random(1, #maps)
guis.ScreenGui.Frame.Visible = true
guis.ScreenGui.Frame.Beingchosen.Visible = true
wait(1)
chosen = maps[ranmap]
chosenclone = chosen:Clone()
chosenclone.Parent = game.Workspace
guis.ScreenGui.Frame.Map.Visible = true
guis.ScreenGui.Frame.Madeby.Visible = true
guis.ScreenGui.Frame.Madeby.Text = "Map is " .. chosen.Name .. " By: Spoookd"
wait(5)
spawn = chosenclone.SpawnPoint
for i,v in pairs(game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
check:MoveTo(spawn.Position)
end
end
guis.ScreenGui.Frame.Visible = false
end
else
guis.ScreenGui.Frame.Visible = false--I moved this
h = Instance.new("Hint", game.Workspace)
h.Text = "You need more than 1 player to play."
end
end

9 comments
Only if FE is enabled. FE is disabled for him.
What? I thought even if FE is enabled, locals aren't allowed to use serverStorage
Even if filtering is enabled, it still won't allow a local script to access server storage.
So what do I do then?
Write the script inside a normal server script instead of a local script or put the maps inside replicatedstorage
Well now I just kept the local script in replicatedfirst and out the maps in replicated storage and this comes up: 17:36:17.662 - ReplicatedFirst.LocalScript:11: bad argument #2 to 'random' (interval is empty)
also if I put it into a normal script and put it into workspace, an error comes up: Workspace.Script:3: attempt to index global 'player' (a nil value)
then you didn't randomly select your map properly; also, the global player thing is because you can't define "game.Players.LocalPlayer" in a server script, only in local scripts. try getting the player with game.Players.PlayerAdded:connect(function(player) --[[do yourstuff here]]-- end)
I am using it in a local script