Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't the teleportation stuff work?

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

12 comments

0

Does it error? If so, what does the error say?

0

I'll check...

0

I wont be able to test this out till Friday, so maybe you can test it out.

0

Actually, DON'T. It won't work unless you test it on my game.

0

While I am waiting, I have tried you game and I want to make some levels with exp. Could you help with that?

0

The error says: "name is not a valid member of Player"

0

BOOM BOOM

0

Oops.

1

@PickUpTheBeat1 Remember that RBLX.Lua is case sensitive which means you need replace "name" with "Name"!!

0

Dang

0

LOL I found out another error.

0

The error is: Argument 1 missing or nil

1 answer

✓ Accepted answer

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

3 comments

0

Yes! my main script is finished! You are a hero!

0

Okay... Now I am working on another game. How would I be able to teleport everyone except one single person?

0

I can figure it out.

This discussion is preserved as it was. New answers, comments, and votes are closed.