If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Notes:Roblox (Windows, Mac OS X)/Revisional Differences/Official Places

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of Notes:Roblox (Windows, Mac OS X)/Revisional Differences.

Making an asset tree

I made the asset tree using the following script, the script needs to be put into the ServerScriptService as a normal script.

local function printTree(prefix, name, classname)
	if not classname then
		script.Value.Value = script.Value.Value .. prefix .. name .. "\n"
	else
		script.Value.Value = script.Value.Value .. prefix .. name .. " (" .. classname .. ")\n"
	end
end

local function traverse(parent, prefix)
	for _, child in ipairs(parent:GetChildren()) do
		printTree(prefix, child.Name, child.ClassName)
		traverse(child, prefix .. "  ")
	end
end

local services = {
	game:GetService("Workspace"),
	game:GetService("ReplicatedStorage"),
	game:GetService("ReplicatedFirst"),
	game:GetService("ServerStorage"),
	game:GetService("ServerScriptService"),
	game:GetService("StarterPack"),
	game:GetService("StarterGui"),
	game:GetService("StarterPlayer"),
}

for _, service in ipairs(services) do
	printTree("", service.Name)
	traverse(service, "  ")
end

For this code to work you need to run it and you need to put a child StringValue inside of the script. It should look like the example tree below.

ServerScriptService
└── Script (Script)
    └── Value (StringValue)

After running the code, make sure you're looking at the game on the serverside. Copy the value found in the StringValue and paste it into this website. Now copy the tree using the Copy button found at the top of the screen and put the tree into the page surrounded by the following code.

Code

<pre style='white-space: pre-wrap; overflow: auto; width: 700px'; height: 300px'>

</pre>

Getting the time an asset was updated for the last time

Well just put this code into a script located inside of ServerScriptService. (This is for the specific versions of experiences.)

local asset = game:GetService("MarketplaceService"):GetProductInfo(PutYourAssetIdHere, Enum.InfoType.Asset, VersionValue)
local update_stamp = tostring(asset.Updated)

function ConvertTimeStamp(time_stamp)
	local date_pattern = "%d%d%d%d%-%d%d%-%d%d"
	local stamp_date = string.sub(time_stamp, string.find(time_stamp, date_pattern))

	local split_date = string.split(stamp_date, "-")

	local year = split_date[1]
	local month = split_date[2]
	local day = split_date[3]

	local elapsed_years = (year - 1970)
	local elapsed_months = month - 1
	local elapsed_days = day - 1

	return year, month, day
end

print(ConvertTimeStamp(update_stamp))

Use this if you want the overall last update time:

local asset = game:GetService(“MarketplaceService”):GetProductInfo(PutYourAssetIdHere)
local update_stamp = tostring(asset.Updated)

function ConvertTimeStamp(time_stamp)
	local date_pattern = “%d%d%d%d%A%d%d%A%d%d”
	local stamp_date = string.sub(time_stamp, string.find(time_stamp, date_pattern))

	local split_date = string.split(stamp_date, “-”)

	local year = split_date[1]
	local month = split_date[2]
	local day = split_date[3]

	local elapsed_years = (year - 1970)
	local elapsed_months = month - 1
	local elapsed_days = day - 1

	return year, month, day
end

print(ConvertTimeStamp(update_stamp))