bannedid = {
"77590021", --using my own ID as an example
}
game.Players.PlayerAdded:Connect(function(plr)
for i, v in pairs(bannedid) do
if plr.UserId == v then
plr:Kick("kick")
end
end
end)
I have no idea why this does not work. No output errors or anything. It does work with usernames, but not UserId and I’d rather use the ID.
Thanks in advance.
remove the comma at the start
remove the quotation markz!
also try this:
bannedid = {
77590021
}
game.Players.PlayerAdded:Connect(function(plr)
if table.find(bannedid,plr.UserId) then
plr:Kick("You have been kicked")
end
end)
You don’t necessarily have to remove the comma though, and this same leeway is found in Javascript, just so long as the } isn’t found in the same line as the last comma.
So this is fine (for example):
local t = {
0,
1,
}
But this kind of format will error if there is no value after the last comma:
Also another question, does anyone know why using "\n" in the message for a kick does not create new lines? It does disappear/create a space but it doesn’t create new lines.
Probably a response to games that would create infinitely long lines of text. The kinds of scripts I saw in script games would fill as much space as possible when you were kicked by them, which would be annoying.
Even then, I am not sure why else line breaks are disabled, since after all, it’s not like it’s blocking any critical buttons or something.
roblox disabled new lines in a Kick message so if people tried to do “lol \n lol \n lol. etc” it would block out the Leave button (even though you can exit with Alt f4 or turn off your phone)