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

What is wrong with this part of the script?

Asked by 9 years ago

I had an error on this script, but I don't know what is wrong with it. This is the part where it had an error:

            local randomspawn = lobbyspawns[math.random(1, #lobbyspawns)]
            player.Character:MoveTo(randomspawn.Position)

            local backpack = player:FindFirstChild("Backpack")
            if backpack then
                backpack:ClearAllChildren()
            end
        end
    end
    killer = nil
    sheriff = nil

This is the error:

18:27:57.937 - ServerScriptService.MainScript:458: bad argument #2 to 'random' (interval is empty)
18:27:57.939 - Script 'ServerScriptService.MainScript', Line 458
18:27:57.941 - Stack End
1
Make sure lobbyspawns is a table as well has an amount over 1. User#5978 25 — 9y
0
What do you mean as a table? User#5689 -1 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

you should do more than one lobbyspawn.

0
I did do more than one lobby spawn. I made like 9 of them. User#5689 -1 — 9y
Ad

Answer this question