So i have a ban script here, but the thing is when my username is not the first player in the table, the ban script doesnt work
the main script
local bindablefunc = game:GetService("ReplicatedStorage").GetBanList
local banlist = {"randomguy", "youngafrocom", "anotherguy"}
bindablefunc.OnInvoke = function(player)
for i, v in ipairs(banlist) do
if v == player.Name then
print("Player is in the ban list.")
return true
else
print("Player is not in the ban list.")
return false
end
end
end
the script that invokes
local bindablefunc = game:GetService("ReplicatedStorage").GetBanList
game.Players.PlayerAdded:Connect(function(player)
wait(1)
local checkbanlist = bindablefunc:Invoke(player)
if checkbanlist == true then
player:Kick("You are banned from the game")
end
end)