The script is here:
minigames = game.Lighting.Minigames:GetChildren() number = math.random(1, #minigames) map = minigames[number] spawns = map.Spawns:GetChildren() function Intermission() wait(2) for value = 35, 0, -1 do wait(1) game.Workspace.Timer.Value = "The game will start in "..value.." seconds." end wait(1) game.Workspace.Timer.Value = "Which map will we choose?" wait(3) game.Workspace.Timer.Value = "Map: "..map.Name.."." wait(3) map:clone() map.Parent = workspace for i,v in pairs(game.Players:GetPlayers()) do local name = v.name local check = game.Workspace:FindFirstChild(Name) if check then local checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid then check:MoveTo(spawns[i].Position) end end end for value2 = 3, 0, -1 do wait(1) game.Workspace.Timer.Value = value2 end game.Workspace.Timer.Value = "GOOO!!" wait(1) for value3 = 60, 0, -1 do wait(1) game.Workspace.Timer.Value = "Time left: "..value3 end game.Workspace.Timer.Value = "Game over! Winners get 15 points!" map:remove() return true end while true do wait(1) local Int = Intermission() end
The error is:Argument 1 is missing or nil 07:25:34.764 - Argument 1 missing or nil 07:25:34.764 - Script 'Workspace.Script', Line 23 - global Intermission 07:25:34.764 - Script 'Workspace.Script', Line 45
When you get an error in the output, it will almost always follow this format (a few error messages are buggy and don't, but these are mostly fixed by now):
07:25:34.764 - Argument 1 missing or nil
07:25:34.764 - Script 'Workspace.Script', Line 23 - global Intermission
07:25:34.764 - Script 'Workspace.Script', Line 45
The first line will be in red. It is the actual problem. In this case, Argument 1 missing or nil. An "argument" is something you give to a function--in ()
-- so there is somewhere that you give nil
, which is an error.
The next lines are the "stack" -- they say how you got to the point.
This says workspace.Script
line 23 (in the function "Intermission") is the cause of the error.
Because of weird problems, sometimes line numbering is off by a small amount. It's likely complaining about this line:
local check = game.Workspace:FindFirstChild(Name)
"Argument 1 is nil", which means for some reason Name
must be nil
.
In fact, it is -- you never defined Name
, you defined name
-- these are case-sensitive.
Name
should be name
.
The for
loop over players has some problems.
:GetPlayers()
returns things in an un-ordered way, so it's unlikely that i
will be useful to you.
v
is a really poor name for a player
.
player.Character
is what you should use instead of looking in the workspace for an object of the same name
Perhaps something like this would be better:
for _, player in pairs(game.Players:GetPlayers()) do local character = player.Character local randomSpawn = spawns[math.random(#spawns)] -- EDIT if character then character:MoveTo(randomSpawn.Position) -- EDIT end end
value2
and value
are really poor names for time
or timeRemaining