Hello, i was making a ban script to ban anyone that isnt allowed to test if the script is not disabled. However it doesnt work, any explanations or answers why?
local reason = ("Game is closed for testing.")
local allowed = ("ChronoFantastic")
while true do
wait(.1)
for i,v in pairs(game.Players:GetChildren()) do
if v ~= allowed then
v:Kick(reason)
elseif v == allowed then
end
end
end

9 comments
I think it's because on line 6 where it says v you need to say v.Name. Also, you would need to do allowed[1].
^ Thanks ill try that. Oh and ill post the output too. I use script analysis too to help
IT WORKED! Thank you for your help :)
You're very welcome, also I don't think you have to do, "allowed[1]," because I just realized the allowed variable wasn't a table.
Can you friend me on roblox though?
Request sent.
Done.
In lines 1-2, you wrapped your string in brackets. Brackets are math exclusive. Remove them.
^ The questions answered already. Sorry.