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

Script Error For Local? Argument Expected Near Local?

Asked by 4 years ago
Edited 4 years ago

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

``

0
Function Argument Expected Near Local on Line 16 theneverwas_kid 12 — 4y
0
imagine a while true do, inside a while true do Arkrei 389 — 4y
0
help?! theneverwas_kid 12 — 4y

2 answers

Log in to vote
0
Answered by
cegberry 432 Moderation Voter
4 years ago

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

Ad
Log in to vote
0
Answered by 4 years ago

line 12:

 local allmaps = maps:GetAllChildren

line 12:

 local allmaps = maps:GetAllChildren()

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

Answer this question