Unable to get For function to work

I want to get this track to switch and I have tried multiple ways to get this to work but simply will not work. It’s been a head scratcher.

The track will switch one way but not other over and its only getting certain children for what ever reason.

I spent a good 3 hours trying to diagnose the problem every way I could but the only way I found was to list off one block at a time which is inefficient.

local triggered = false
local RightGroup = script.Parent.Right:GetChildren()
local LeftGroup = script.Parent.Straight:GetChildren()

function click()
        triggered = false
        for i, RightTracks in pairs(RightGroup,LeftGroup) do
        if triggered == true then
        triggered = false
            RightTracks.Transparency = 1
            RightTracks.CanCollide = false
            LeftGroup.Transparency = 0 -- you set this to what you want
            LeftGroup.CanCollide = true -- also set this to what you want
        elseif triggered == false then
        triggered = true
            RightTracks.Transparency = 0
            RightTracks.CanCollide = true
            LeftGroup.Transparency = 1 -- you set this to what you want
            LeftGroup.CanCollide = false -- also set this to what you want
        end
    end
end
script.Parent.Clicker.ClickDetector.MouseClick:Connect(click)

pairs() only accepts one argument. Lua Globals | Roblox Creator Documentation

Move them into a single table.

local triggered = false
local group = {
    script.Parent.Right:GetChildren(),
    script.Parent.Straight:GetChildren()
}

function click()
        triggered = false
        for i, RightTracks in pairs(group) do
        if triggered == true then
        triggered = false
            RightTracks.Transparency = 1
            RightTracks.CanCollide = false
            LeftGroup.Transparency = 0 -- you set this to what you want
            LeftGroup.CanCollide = true -- also set this to what you want
        elseif triggered == false then
        triggered = true
            RightTracks.Transparency = 0
            RightTracks.CanCollide = true
            LeftGroup.Transparency = 1 -- you set this to what you want
            LeftGroup.CanCollide = false -- also set this to what you want
        end
    end
end
script.Parent.Clicker.ClickDetector.MouseClick:Connect(click)

Left out multiple variables. Ive made multiple attempts at this haha. Any help is best help

Fixed it. You are a life saver

My bad, I just tried to skim through it lol I’ll fix it in the post.