Print Players Username

Hello developers, I am having a problem with this script; This script print players who are in a certain group rank or higher ones triggers, it only prints out the person who fired the event.

Any help is appreciated.

local db4 = false
local function log()
    if db4 == false then
        db4 = true
        local Range = ""
        for _, Player in pairs(game.Players:GetPlayers()) do
            if Player:GetRankInGroup(group) >= logid then
                if #Range == 0 then
                    Range = Range .. Player.Name
                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "LOGGED"
                    wait(3)
                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "COOLDOWN"
                    game.ReplicatedStorage:FindFirstChild("sessionsFolder").logSessions:FireServer(Range)

                    wait(coolDown)
                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "LOG"
                    db4 = false



                else
                    Range = Range .. ", " .. Player.Name

                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "LOGGED"
                    wait(3)
                    game.ReplicatedStorage:FindFirstChild("sessionsFolder").logSessions:FireServer(Range)

                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "COOLDOWN"
                    wait(coolDown)
                    Frame.Other.LogAt.MainHost.LogAttendence.Text = "LOG"
                    db4 = false


                end

            end

        end


    end



end

What are we looking at? This script doesn’t have any prints or OnServerEvent(), which you said was the main issue.