Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

is this right?


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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.