So, today I was stuck offline for most of the day, but I really needed to work on my latest Fallout build, so I thought of a way to work offline with Decals and Textures using the default rbxasset://textures root folder to hold a subfolder that stores all of my offline decals and textures, however the super-duper annoying part of going online is switching all 557 decal/texture objects to online mode would be a pain in the butt and even more so when I needed to go back offline again, so I thought to myself, why not write up a script to do it for me?
Well, here it is :
local SwtichToMode = "Online"
local Offline_Online_TextureIDs = {
{ -- Red_Wood
Offline = "rbxasset://textures/Test/Red_Wood.png" ,
Online = "http://www.roblox.com/Asset/?ID="..187609516,
},
{ -- Red_Wood_2
Offline = "rbxasset://textures/Test/Red_Wood_2.png" ,
Online = "http://www.roblox.com/Asset/?ID="..187540539,
},
{ -- Red_Wood_3
Offline = "rbxasset://textures/Test/Red_Wood_3.png" ,
Online = "http://www.roblox.com/Asset/?ID="..187540613,
},
{ -- Novac_Wall
Offline = "rbxasset://textures/Test/NovacWall.png" ,
Online = "http://www.roblox.com/Asset/?ID="..187540642,
},
{ -- Novac_Screen
Offline = "rbxasset://textures/Test/Novac_Screen.png" ,
Online = "http://www.roblox.com/Asset/?ID="..187609640,
},
}
function SearchTable(Texture)
for _,MAIN in pairs(Offline_Online_TextureIDs) do
--for i,CurrentSubTable in pairs(MAIN) do
local tab = MAIN
if SwtichToMode == "Online" then
if Texture == tab.Offline then
return tab.Online
elseif Texture == tab.Online then
return tab.Offline
end
elseif SwtichToMode == "Offline" then
if Texture == tab.Online then
return tab.Offline
elseif Texture == tab.Offline then
return tab.Online
end
end
--end
end
return Texture
end
function GetPartsInGame(Table,Instance)
if Table ~= nil then
if Instance ~= nil then
for i,v in pairs(Instance:GetChildren()) do
if v:IsA("BasePart") or v:IsA("UnionOperation") then
Table[#Table+1] = v
else
GetPartsInGame(Table,v)
end
end
end
end
end
function GetDecalTexturesInTable(Table)
for i,Part in pairs(Table) do
for p,v in pairs(Part:GetChildren()) do
if v:IsA("Decal") or v:IsA("Texture") then
local NewTexture = SearchTable(v.Texture)
--print(NewTexture)
v.Texture = NewTexture
--print(v.Parent.Name.."'s Texture is :"..NewTexture)
end
end
end
end
do
local Objects = {}
GetPartsInGame(Objects,game.Workspace)
GetPartsInGame(Objects,game.Lighting)
GetPartsInGame(Objects,game.ReplicatedStorage)
print(#Objects)
GetDecalTexturesInTable(Objects)
print("---------------------------------------------------------------------------------------------------------")
end
How to use:
Step 1.) : Open up whatever is your favorite offline script editor program, copy and paste the code above into your editor.
Step 2.)Change the sub-table’s (what do you call these?) Offline string to the correct root of where the texture is being stored in the texture’s folder, for myself its : C:\Users\Owners\AppData\Local\Roblox\Versions\version-9bfbbf0b67514492\content\textures\Test which translate to rbxasset://textures/Test/. Now that you have the file’s path, add the files name and file type to the end of the string like so :
rbxasset://textures/Test/Derpyface.png
Step 3.) Rinse and repeat until you have your offline texture collection finished.
Step 4.) When you are connected to the internet, go to online and upload all of the decals and replace the sub-table’s Online Id’s numbers to the correct Id for the decal.
Step 5.) After doing step 4 for ALL of the sub-tables, go ahead and change the SwtichToMode string to “Online” and run the script in the Command Bar.
Step 6.) ???
Step 7.) Profit.
Now, enjoy!