Ad
Log in to vote
0

Why does this script kick the person who warned instead of the person with the warnings?

Asked by
ghxstlvty 133
9 days ago
    local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
        local Player = Args[1]

        if Args[3] then
            local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
            local combinedVictims = ''
            for a,b in pairs(Victims) do
                if combinedVictims == '' then
                    combinedVictims = b.Name
                else
                    combinedVictims = combinedVictims..', '..b.Name
                end
            end
            for a,b in next,Victims do

                local Warns = game.Players[combinedVictims].BAEWarns
                table.insert(LocalWarns, Warns.Value)
                print(LocalWarns)
                Warns.Value += 1
                remoteEvent:FireClient(b,'Notif','Warn','You have been warned',{'Results','E',combinedVictims})
                if table.find(LocalWarns, 1) then
                    Player:Kick("You have been kicked from the game for max warnings. If you chose to rejoin and continue, you will be banned for 24 hours.")
                end
            end
        end
    end

Answer this question