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.
consider removing the "return false", the loop will only run once since when you return inside a function it ends any current loops in that thread.