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

Why isn't this working? I keep getting a message saying it expected "end" or ")"

Asked by 4 years ago
Edited by SerpentineKing 4 years ago
timer = 10
    repeat wait()
        configs.Status.Value = "Map vote: ".. timer

        wait(1)
        timer = timer - 1
    until timer == 0

    local map
    local highest = 0
    for i,v in pairs(rStorage.Votes:GetChildren()) do
        if v:IsA("IntValue") then
            local curMap = maps:FindFirstChild(v.Name)
            if v.Value > highest and curMap then
                map = curMap
            end
        end
    end

    if map then
        configs.Status.Value = map.Name.. " has been selected"
    else
        map = maps:GetChildren()[1]
        configs.Status.Value = map.Name.. " has been selected"
    end

    map = map:Clone()
    map.Parent = workspace

    rEvents.RemoveAllVotes:FireAllClients()

    for i,v in pairs(rStorage.Votes:GetChildren()) do
        v:Destroy()
    end

    wait(3)

    for i,v in pairs(gamemode) do
        if v == "Player" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,43962930)
        elseif v == "Bot" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,1051200900)
        elseif v == "Player + Bot" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,56873560)
        end
    end

    timer = 10
    repeat wait()
        configs.Status.Value = "Gamemode vote: ".. timer

        wait(1)
        timer = timer - 1
    until timer == 0

    local mode
    local highest = 0
    for i,v in pairs(rStorage.Votes:GetChildren()) do
        if v:IsA("IntValue") then
            local curMode = rStorage.Votes:FindFirstChild(v.Name)
            if v.Value > highest and curMode then
                mode = curMode.Name
            end
        end
    end

    wait(1)

    if #game.Players:GetPlayers() > 1 then
        if mode then
            configs.Status.Value = mode.. " has been selected"

            if mode == "Player" then
                configs.Killer.Value = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]

                configs.Status.Value = configs.Killer.Value.Name.. " has been selected as the killer!"
            end
        else
            mode = gamemode[1]
            configs.Status.Value = mode.. " has been selected"
        end
    else
        mode = "Bot"
        if mode then
            configs.Status.Value = mode.. " has been selected"
        else
            mode = gamemode[1]
            configs.Status.Value = mode.. " has been selected"
        end
    end

    wait(2)

    for i,v in pairs(game.Players:GetPlayers()) do
        if v.InLoading.Value == true then
            coroutine.resume(coroutine.create(function()
                configs.CanJoin.Value = false
                rEvents.HidePlayers:FireClient(v)

                rEvents.FadeIn:FireClient(v)
                wait(1)
                rEvents.HideMainMenu:FireClient(v)
            end))
        end
    end

    wait(2)
    rEvents.FadeOut:FireAllClients()

    if cutsceneList[map.Name] then
        cutsceneList[map.Name](map)
    end

    local mConfigs = map:FindFirstChild("Configs")
    coroutine.resume(coroutine.create(function()
        if mode == "Player" or mode == "Player + Bot" then
            print("Mode")
            local plr = game.Players:FindFirstChild(configs.Killer.Value.Name)
            if plr then
                print("Found player")
                local skinVal = plr.CurrentSkin
                local skin = rStorage:WaitForChild("Skins"):FindFirstChild(skinVal.Value)

                if skin then
                    print("A")
                    local clone = skin:Clone()
                    clone.Name = plr.Name

                    plr.Character = clone
                    clone.Parent = workspace
                end
            end
        end

        wait(15)

        cutsceneModule.typeText()
        if mConfigs then
            if mode == "Bot" then
                local botName = mConfigs:FindFirstChild("BotName")
                if botName then
                    local bot = rStorage.Bots:FindFirstChild(botName.Value)
                    if bot then
                        local clone = bot:Clone()
                        clone.Parent = workspace

                        local rootPart = clone:FindFirstChild("HumanoidRootPart") or clone:FindFirstChild("Torso")
                        if rootPart then
                            rootPart.CFrame = map.KillerSpawn.CFrame
                        end
                    end
                end
            end
        end
    end))

    startGame(map,mode)

    map.Name = "Map"
    wait(2)
    rEvents.FadeOut:FireAllClients()
    end)
    end

0
Full code:                                                                                                                                               local rStorage = game:GetService("ReplicatedStorage") local rEvents = rStorage:WaitForChild("RemoteEvents") local configs = rStorage:WaitForChild("Configs") local maps = rStorage:WaitForChild("Maps") local dStore = game:GetService("DataStoreServic chemistk1 7 — 4y
0
what line does the error say it happened on? DarkDanny04 407 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Hello. You have a few extra ")'s". Try this:

timer = 10
    repeat wait()
        configs.Status.Value = "Map vote: ".. timer

        wait(1)
        timer = timer - 1
    until timer == 0

    local map
    local highest = 0
    for i,v in pairs(rStorage.Votes:GetChildren()) do
        if v:IsA("IntValue") then
            local curMap = maps:FindFirstChild(v.Name)
            if v.Value > highest and curMap then
                map = curMap
            end
        end
    end

    if map then
        configs.Status.Value = map.Name.. " has been selected"
    else
        map = maps:GetChildren()[1]
        configs.Status.Value = map.Name.. " has been selected"
    end

    map = map:Clone()
    map.Parent = workspace

    rEvents.RemoveAllVotes:FireAllClients()

    for i,v in pairs(rStorage.Votes:GetChildren()) do
        v:Destroy()
    end

    wait(3)

    for i,v in pairs(gamemode) do
        if v == "Player" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,43962930)
        elseif v == "Bot" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,1051200900)
        elseif v == "Player + Bot" then
            local intValue = Instance.new("IntValue",rStorage.Votes)
            intValue.Name = v
            intValue.Value = 0
            rEvents.CreateVote:FireAllClients(v,56873560)
        end
    end

    timer = 10
    repeat wait()
        configs.Status.Value = "Gamemode vote: ".. timer

        wait(1)
        timer = timer - 1
    until timer == 0

    local mode
    local highest = 0
    for i,v in pairs(rStorage.Votes:GetChildren()) do
        if v:IsA("IntValue") then
            local curMode = rStorage.Votes:FindFirstChild(v.Name)
            if v.Value > highest and curMode then
                mode = curMode.Name
            end
        end
    end

    wait(1)

    if #game.Players:GetPlayers() > 1 then
        if mode then
            configs.Status.Value = mode.. " has been selected"

            if mode == "Player" then
                configs.Killer.Value = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]

                configs.Status.Value = configs.Killer.Value.Name.. " has been selected as the killer!"
            end
        else
            mode = gamemode[1]
            configs.Status.Value = mode.. " has been selected"
        end
    else
        mode = "Bot"
        if mode then
            configs.Status.Value = mode.. " has been selected"
        else
            mode = gamemode[1]
            configs.Status.Value = mode.. " has been selected"
        end
    end

    wait(2)

    for i,v in pairs(game.Players:GetPlayers()) do
        if v.InLoading.Value == true then
            coroutine.resume(coroutine.create(function()
                configs.CanJoin.Value = false
                rEvents.HidePlayers:FireClient(v)

                rEvents.FadeIn:FireClient(v)
                wait(1)
                rEvents.HideMainMenu:FireClient(v)
            end)
        end
    end

    wait(2)
    rEvents.FadeOut:FireAllClients()

    if cutsceneList[map.Name] then
        cutsceneList[map.Name](map)
    end

    local mConfigs = map:FindFirstChild("Configs")
    coroutine.resume(coroutine.create(function()
        if mode == "Player" or mode == "Player + Bot" then
            print("Mode")
            local plr = game.Players:FindFirstChild(configs.Killer.Value.Name)
            if plr then
                print("Found player")
                local skinVal = plr.CurrentSkin
                local skin = rStorage:WaitForChild("Skins"):FindFirstChild(skinVal.Value)

                if skin then
                    print("A")
                    local clone = skin:Clone()
                    clone.Name = plr.Name

                    plr.Character = clone
                    clone.Parent = workspace
                end
            end
        end

        wait(15)

        cutsceneModule.typeText()
        if mConfigs then
            if mode == "Bot" then
                local botName = mConfigs:FindFirstChild("BotName")
                if botName then
                    local bot = rStorage.Bots:FindFirstChild(botName.Value)
                    if bot then
                        local clone = bot:Clone()
                        clone.Parent = workspace

                        local rootPart = clone:FindFirstChild("HumanoidRootPart") or clone:FindFirstChild("Torso")
                        if rootPart then
                            rootPart.CFrame = map.KillerSpawn.CFrame
                        end
                    end
                end
            end
        end
    end)

    startGame(map,mode)

    map.Name = "Map"
    wait(2)
    rEvents.FadeOut:FireAllClients()
    end)
    end

Ad

Answer this question