Skip to content

Instantly share code, notes, and snippets.

@Pedr1ch
Created November 28, 2021 13:34
Show Gist options
  • Save Pedr1ch/4360327aa46b70810704f84f68544a53 to your computer and use it in GitHub Desktop.
Save Pedr1ch/4360327aa46b70810704f84f68544a53 to your computer and use it in GitHub Desktop.
-- this an modulescript for roblox studio API. Do not execute this using lua-u.
local dir = workspace or game.Workspace
local insts = dir:GetChildren()
local printDirInfo = {}
function printDirInfo:Children(insts,dir)
insts = dir:GetChildren()
for i in pairs(insts) do
if insts.Name then
local genDiag = insts.Name
print(genDiag)
elseif insts.Name == nil then
local function checkDiag(diag)
if diag == nil then
print("Can't read instance number "..i..". Read Error Below")
warn("Error Code -1, results: diag is nil, try to index the ")
else
print(diag)
return
end
end
local genDiag = tostring(insts[i])
checkDiag(genDiag)
end
end
end
function printDirInfo:Name(dir)
if dir.Name then print("Directory name is: "..tostring(dir.Name))
else
warn("You need to set an Instance. Function Cannot Continue... -4")
print("Dir Name Result: "..dir.Name)
end
end
function printDirInfo:ShowPermissionId()
if script:IsA("LocalScript") or script:IsA("Script") then print("Permission Id: "..Enum.PermissionLevelShown.RobloxScript.Value) end
local runService = game:GetService("RunService")
if runService:IsStudio() then
print("You're on studio; Permission ID is Unknown. ")
end
if runService:IsClient() then
print("You're an client.")
end
if runService:IsServer() then
print("You're the server. Inf perms id")
end
end
function printDirInfo:getClass(dir)
if dir.ClassName == nil then
warn("Class Name is nil / dir parameter is not an instance. Function Can't Continue... -5")
else
print("Dir Class Name: "..tostring(dir.ClassName))
end
end
return printDirInfo
@Pedr1ch
Copy link
Author

Pedr1ch commented Nov 28, 2021

require the module script first.

functions: Get Directory Children, Class, Name, Current Permission ID;
63 lines, scripted by pedrich / @Phroaguz in roblox. Open Source Project, if possible, please mention me when you're going to use this atleast, or give credits and a link for the gists. Thanks.

Shout-outs to: @boatbomber (Because why not XD), @caiomgt (Helped me to fix "Module doesnt return one exact value for requiring"), @cafcover (Best friend+dev helper).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment