Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't the teleportation stuff work?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

0
Does it error? If so, what does the error say? ClassicTheBlue 65 — 8y
0
I'll check... NeonicPlasma 181 — 8y
0
I wont be able to test this out till Friday, so maybe you can test it out. NeonicPlasma 181 — 8y
0
Actually, DON'T. It won't work unless you test it on my game. NeonicPlasma 181 — 8y
View all comments (8 more)
0
While I am waiting, I have tried you game and I want to make some levels with exp. Could you help with that? NeonicPlasma 181 — 8y
0
The error says: "name is not a valid member of Player" NeonicPlasma 181 — 8y
0
BOOM BOOM NeonicPlasma 181 — 8y
0
Oops. NeonicPlasma 181 — 8y
1
@PickUpTheBeat1 Remember that RBLX.Lua is case sensitive which means you need replace "name" with "Name"!! UserOnly20Characters 890 — 8y
0
Dang NeonicPlasma 181 — 8y
0
LOL I found out another error. NeonicPlasma 181 — 8y
0
The error is: Argument 1 missing or nil NeonicPlasma 181 — 8y

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

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

0
Yes! my main script is finished! You are a hero! NeonicPlasma 181 — 8y
0
Okay... Now I am working on another game. How would I be able to teleport everyone except one single person? NeonicPlasma 181 — 8y
0
I can figure it out. NeonicPlasma 181 — 8y
Ad

Answer this question