Whitelist broken?

Idk why but the whitelist for get parts in bound doesn’t work suddenly, although I didn’t change anything in the script, is it sth with roblox?

Here’s a simple whitelist system.

local WhitelistedUsernames = {"username"}
local WhitelistedUserIDs = {"1234"}


-- USERID'S
game.Players.PlayersAdded:Connect(function(plr)
      for i, userid in pairs(WhitelistedUserIDs) do
             if plr.UserId == userid then
             print("allowed")
     else
           plr:Kick("not whitelisted")
       end
end)

-- USERNAMES
game.Players.PlayersAdded:Connect(function(plr)
      for i, username in pairs(WhitelistedUsernames) do
             if plr.Name == username then
             print("allowed")
     else
           plr:Kick("not whitelisted")
       end
end)

This should work.