So now the group rank gate works, but I want it to make it to play two audios. I know how to make audios play using a script in the clickdetector but that will play for anyone. I only want it to play if they gate is opening so that it detects that the person is in fact in the group so it plays it. Any solutions? Script:

local groupID = 5090636                 --Group ID
local rankNumber = 255                  --Role Number
local higherRanksAllowed = true         --Only works with rank numbers
local moving = false
local open = false

function onClick(trigger, gate)--2
local trigger = script.Parent
local gate = script.Parent.Parent.Gate


    if open == false and moving == false then--3

        moving = true
local audio = script.Parent.Parent.Audio --//A variable to put our audio in so it's easier to reference it

    if (audio.IsPlaying == false) then --//It isn't playing so we start it
        audio:Play()
		wait(7.5599999999999996092)
        audio:Stop()
    end
local audio = script.Parent.Parent.Audio --//A variable to put our audio in so it's easier to reference it

    if (audio.IsPlaying == false) then --//It isn't playing so we start it
        audio:Play()
		wait(7.5599999999999996092)
        audio:Stop()
    end


        trigger.BrickColor = BrickColor.new("Bright yellow")

        for i = 1, (gate.Size.Y * 10 + 1) do--4
            wait()
            gate.CFrame = gate.CFrame*CFrame.new(0, 0.1, 0)
        end--c4

        moving = false
        open = true
        trigger.BrickColor = BrickColor.new("Bright red")

    elseif open == true and moving == false then

        moving = true
        trigger.BrickColor = BrickColor.new("Bright yellow")

        for i = 1, (gate.Size.Y * 10 + 1) do--5
            wait()
            gate.CFrame = gate.CFrame*CFrame.new(0, -0.1, 0)
        end--c5

        moving = false
        open = false
        trigger.BrickColor = BrickColor.new("Bright green")

    end--c3

end--c2
function clicked(player)
    print("click detected")
    if player:IsInGroup(groupID) then
        if rankNumber ~= nil then                                           --Rank Number
            if player:GetRankInGroup(groupID) == rankNumber then
                onClick()
            elseif player:GetRankInGroup(groupID) > rankNumber and higherRanksAllowed then
                onClick()
            end
            discontinueScript = true
        elseif roleName ~= nil and not discontinueScript then           
            if player:GetRoleInGroup(groupID) == roleName then
                onClick()
            end
        else
            error("No valid rank number or role name set!")
        end
    end
end

script.Parent.ClickDetector.MouseClick:connect(clicked)