wait(1)
game.Players.PlayerAdded:Connect(function(plr)
wait(1)
local banfolder = game.Lighting:FindFirstChild("ServerBans")
if banfolder:FindFirstChild(plr.Name) then
plr:Kick("Unable to connect to server for reason: You have been banned.")
print("[AdminGUI Plugin] ".. plr.Name .. " Attempted to join the server but failed with the error message: Player Banned.")
else
print("[AdminGui Plugin] "..plr.Name.." passed the ban check.")
end
end)
This is not the only thing in the script. This is just a part and every thing else runs but this.

7 comments
Also this is the top of the script.
Have you tried game.Lighting:WaitForChild(“ServerBans”)?
Also would it not make more sense to store something like this is ReplicatedStorage rather than lighting
Do there's any errors in the output?
ReplicatedStorage is when everyone can access it, a hacker maybe can delete some banlists and pass by the check. You should put it in the ServerStorage since only the server can access it and players can't which essentially creates a secure place to store things that shouldn't be in the hands of a player.
Also the reason why a lot of people are saying events don't work is because of a if statement that is blocking what they are supposed to do. In the event you are checking if the player joined is in the ban list and will only execute code if so. I assume your testing and you don't have the usernames in the ban list and that's why it looks like it "doesn't execute".
123nabilben123, I am not testing. I used to have it in ServerStorage I was seeing is Lighting made a diffrence. Txeer, I was thinking of doing that I will check if that makes a diffrence.