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

Script Error For Local? Argument Expected Near Local?

I'm not sure why, but it says argument for local on line 12? Help me please. `` local roundtime = 145 local intermissiontime = 15

local serverstorage = game:GetService("ServerStorage")
local replicatedstorage = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local event = replicatedstorage:WaitForChild("RemoteEvent")
local maps = serverstorage:WaitForChild("Maps")
local mapholder = game.Workspace:WaitForChild("MapHolder")

while true do
	mapholder:ClearAllChildren()
	wait(2)
	local allmaps = maps:GetAllChildren
	local newmaps = allmaps[math.random(1, #allmaps)]
	newmap.Parent = game.Workspace
	wait(2)

	while true do
		wait(5)
		contestants{}
		for _, player in pairs(game.Players:GetPlayers()) do
			if player and player.Character then
				local humanoid = player.Character:WaitForChild("Humanoid")
				if humanoid and humanoid.Health > 0 then
					table.insert(contestants, player)
				end
			end
		end
		if #contestants >= 2
		break
		else
		end
	end

	killer = contestants[math.random(1, #contestants)]
	while true do
		randomplayer = contestants[math.random(1, #contestants)]
		if randomplayer ~= bloxxer then
			sheriff = randomplayer
			break
		end
	end

	local spawns = newmap:WaitForChild("Spawns"):GetChildren()
	for _, player in pairs(contestants) do
		if player and player.Character and #spawns >= 0 then
			torso = player.Character:WaitForChild("Torso")
			local spawnindex = math.random(1, #spawns)
			table.remove(spawns, spawnindex)
			torso.CFrame = Cframe.new(spawn.Position + Vector3.new (0, 3, 0,))
		
			local matchtag = Instance.new("StringValue")
			matchtag.Name = "MatchTag"
			matchtag.Parent = player.Character
		
			local backpack = players.FindFirstChild("Backpack")
			if player == bloxxer then
				local sword = serverstorage:WaitForChild("Sword"):clone()
				sword.Parent = backpack
			else if player == sherrif then
				local handgun = serverstorage:WaitForChild("Handgun"):clone()
				handgun.Parent = backpack
		end
	end
end
spawnsmodel:remove()

local localtimer = roundtime
while localtimer > 0 do
while true do
	wait(1)
	localtimer = localtimer - 1
	activecontestants = {}
	killeractive = false
	for _, players in pairs(contestants) do
		if player then
			local character = player.Character
			if character then
				local matchtag = character:FindFirstChild("MatchTag")
				local humanoid = character:FindFirstChild("Humanoid")
				local matchtag and humanoid and humanoid.Health >= 0 then
					if player == bloxxer then
						bloxxeractive = true
					end
			
					table.insert(activecontestants, player)
				end
			end
		end
		if #activecontestants <=1 or not bloxxeractive then
			break
		end
	end

	local gameresults = ("PlayersWin")
	if bloxxeractive then
		if #contestants >=2
	else
			gameresults = ("BloxxerWin")
		end
	else
	end
			
	local lobbyspawns = {}
	for _, v in pairs(game.Workspace:WaitForChild("Lobby"):GetChildren()) do
		if v and v.Name == "SpawnLocation" then
			table.insert(lobbyspawns, v)
		end
	end
	for _, player in pairs(activecontestants) do
		if player then
			if player.Character then
				local humanoid = character:FindFirstChild("Humanoid")
				if humanoid then
					humanoid:UnequipTools
				end
			end
			local randomspawn = lobbyspawns[math.random(1, #lobbyspawns)]
			player.Chararcter:MoveTo(randomspawn.Positions)
			local backpack = player:FindFirstCHild("Backpack")
			if backpack then
				backpack:ClearAllChildren()
			end
		end
	end

	wait()
end

``

3 comments

0

Function Argument Expected Near Local on Line 16

0

imagine a while true do, inside a while true do

0

help?!

2 answers

Your code is very messy, but your missing the () part for :GetChildren on line 11, and on line 18 there is a line of code, “contestants{}”, which is also a problem, on line 113, your missing () for EquipTool, on line 117, you spelled Character wrong, on line 117, and on line 118, your using a different kind of FindFirstChild, which doesn’t exist, because Lua is cap sensitive, and I see tons of deprecated methods, including :remove(), and :clone(), these should be replaced by :Destroy() and :Clone(); That many while true dos in a while true do, can cause serious performance impact, over time

line 12:

 local allmaps = maps:GetAllChildren

line 12:

 local allmaps = maps:GetAllChildren()

:GetAllChildren() is a function. Returning something. In this case a table.

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