Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GetFullName(instance)
- if instance == game then
- return game.Name
- elseif instance.Parent == nil then
- return instance.Name
- else
- local parent = instance
- local fullName = ""
- while true do
- if parent.Parent == game then
- fullName = parent.ClassName .. fullName
- return fullName
- else
- local name = parent.Name
- if name:match("[^%w_]") or tonumber(name:sub(1, 1)) then
- fullName = ("[%q]"):format(name) .. fullName
- elseif name == "" then
- fullName = "[\"\"]" .. fullName
- else
- fullName = (".%s"):format(name) .. fullName
- end
- end
- parent = parent.Parent
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement