I get the error that alien rush is not a valid member of workspace
the order goes game < ServerStorage < Games < Alien Rush
Status = game.ReplicatedStorage.Status
games = game:GetService("ServerStorage"):WaitForChild("Games"):GetChildren()
while true do
count = 10
while count ~= -1 do
wait(1)
Status.Value = "Intermission("..count..")"
count = count - 1
end
Status.Value = "Selecting Game."
wait(1)
Status.Value = "Selecting Game.."
wait(1)
Status.Value = "Selecting Game..."
wait(1)
local randomGame = math.random(1, #games)
local gameChosen = games[randomGame]
gameClone = gameChosen:Clone()
gameClone.Parent = workspace
Status.Value = "Game Selected: "..gameChosen.Name
wait(2)
Status.Value = "Teleporting(5)"
wait(1)
Status.Value = "Teleporting(4)"
wait(1)
Status.Value = "Teleporting(3)"
wait(1)
Status.Value = "Teleporting(2)"
wait(1)
Status.Value = "Teleporting(1)"
wait(1)
game:GetService("ReplicatedStorage").TeleportGuiIn:FireAllClients()
wait(1.5)
for i,v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").WalkSpeed = 0
v.Character:FindFirstChild("Humanoid").JumpPower = 0
local randomSpawns = math.random(1, 4)
if randomSpawns == 1 then
v.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace[gameClone.Name]:WaitForChild("Targets").Target1.CFrame
inGame = Instance.new("BoolValue",v)
inGame.Name = "inGame"
elseif randomSpawns == 2 then
v.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace[gameClone.Name]:WaitForChild("Targets").Target2.CFrame
inGame = Instance.new("BoolValue",v)
inGame.Name = "inGame"
elseif randomSpawns == 3 then
v.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace[gameClone.Name]:WaitForChild("Targets").Target3.CFrame
inGame = Instance.new("BoolValue",v)
inGame.Name = "inGame"
elseif randomSpawns == 4 then
v.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace[gameClone.Name]:WaitForChild("Targets").Target4.CFrame
inGame = Instance.new("BoolValue",v)
inGame.Name = "inGame"
end
end
count = 5
local mainModule = require(workspace[gameChosen.Name].Main)
game:GetService("ReplicatedStorage").TeleportGuiOut:FireAllClients()
for i,v in pairs(game:GetService("Players"):GetChildren()) do
if v:FindFirstChild("inGame") then
game:GetService("ReplicatedStorage").GuiTween:FireClient(v)
end
end
wait(1)
local fadeIn = coroutine.wrap(function()
local gameMusic = workspace.gameMusic
while true do
wait()
gameMusic.Volume = gameMusic.Volume + .1
if gameMusic.Volume == 1 then
break
end
end
end)
fadeIn()
while count ~= -1 do
wait(1)
Status.Value = "Game Starting("..count..")"
count = count - 1
workspace.Countdown:Play()
end
count = workspace[gameClone.Name].WaitTime.Value
mainModule.mainActivate()
while count ~= -1 do
wait(1)
Status.Value = "Game In Progress("..count..")"
count = count - 1
end
workspace[gameClone.Name].Aliens:Destroy()
Status.Value = "Game Over"
for i,v in pairs(game:GetService("Players"):GetChildren()) do
local inGame = v:FindFirstChild("inGame")
if inGame ~= nil then
inGame.Parent.Character:FindFirstChild("Humanoid").JumpPower = 0
inGame.Parent.Character:FindFirstChild("Humanoid").WalkSpeed = 0
end
end
local fadeOut = coroutine.wrap(function()
local gameMusic = workspace.gameMusic
while true do
wait()
gameMusic.Volume = gameMusic.Volume - .1
if gameMusic.Volume == 0 then
break
end
end
end)
fadeOut()
wait(3.5)
for i,v in pairs(game:GetService("Players"):GetChildren()) do
if v:FindFirstChild("inGame") then
local player = inGame.Parent
player.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace.TeleportEnter.CFrame
player.Character:FindFirstChild("Humanoid").JumpPower = 50
player.Character:FindFirstChild("Humanoid").WalkSpeed = 16
wait(1)
wait(2)
v:FindFirstChild("inGame"):Destroy()
wait(2)
v:WaitForChild("PlayerGui").ShopButton.Frame:TweenPosition(UDim2.new(0.397,0,0.891,0))
else
--placeholder
end
end
--workspace[gameClone.Name]:Destroy()
end

5 comments
Line 129, 106, 66, 36,2 will error if an object other than a Player object resides in Players.!
bump
Well why would a non player be in player's? No need to use player's as a storage place
what object would reside there
bump