EDIT: It turns out it only DOESN'T work if the text contains spaces
I am making a SB game, and for the script executor it has a function that checks for banned functions. It doesn't seem to work. Could anyone help me?
-- List
local banned = {
"TeleportService",
"Teleport Service",
"PlayerGui",
"Players",
"Lighting",
"loadstring",
"StarterGui",
"FireServer",
"InvokeServer",
"Invoke",
"Fire"
}
-- Function
checkIfBanned = function(text)
for i=1,#banned do
if string.find(string.lower(text),string.lower(banned[i])) ~= nil then
warn('__Error: Code contains banned text')
return true
else
warn('Code safe...')
return false
end
end
end
-- Test call
print(checkIfBanned("Teleport Service")) -- Always prints "false" and I don't know why.
It's probably something obvious and I'm just stupid. Any help would be appreciated.

1 comment
You know your loop will only ever run once, right? If the condition is true, it returns true from the function, else it returns false from the function. You probably want to just return false after the loop.