Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

is this right?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

local access = {"","",""} 02 local Player = game.Players.LocalPlayer 03 04 for i = 1, #access do 05 if access[i]:lower() == Player.Name:lower() then 06 script.Parent:Destroy() 07 else 08 local Children = script.Parent.Parent:GetChildren() 09 for i = 1, #Children do 10 if Children[i]:IsA("Script") then 11 Children[i]:Destroy() 12 end 13 end 14 end 15 end

1 answer

Log in to vote
2
Answered by 10 years ago

Yes that's correct, But you gotta put names inside of the Accepted table. And there's an easier way of doing that code.

local Access = {"Name1", "Name2", "Name3"}

local Player = game.Players.LocalPlayer

for i,v in pairs(Access) do
if Player.Name == v then
script.Parent:Destroy()
end
end

for i,v in pairs(script.Parent.Parent:GetChildren()) do
if v:IsA("Script") then
v:Destroy()
end
end
Ad

Answer this question