I've tried to made a whitelist script. It seemed like a pretty easy task but as it showed up later, it isn't. The script kicks me even when my ID is on the script and I don't know why.
local whitelist = { 130021889 -- SpeedyTV_1 } game.Players.PlayerAdded:Connect(function(p) if p.UserId ~= whitelist then p:Kick("Not whitelisted") end end)
The error could be that your not the whitelister Basically you need to make the two conditional statements true
local Players = game:GetService("Players") local WHITELIST = {"names"}-- Change to your preference Players.PlayerAdded:Connect(function (player) if not table.find(WHITELIST, player.Name) then player:Kick() end end)
Here, this should work.
local whitelist = { 130021889 -- SpeedyTV_1 } game.Players.PlayerAdded:Connect(function(p) if not table.find(whitelist, p.UserId) then p:Kick("You are not whitelisted.") end end)