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

What is wrong with this part of the script?

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

2 comments

1

Make sure lobbyspawns is a table as well has an amount over 1.

0

What do you mean as a table?

1 answer

you should do more than one lobbyspawn.

1 comment

0

I did do more than one lobby spawn. I made like 9 of them.

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