Hello Scripters!. I am making a script that takes a building and basically places all its properties into a string which I can use. However I am having some minor issues and been bugging me for a while. So I decided to go to the world to see if anyone could spot my error. Anyways before I set you off to do what you do let me give you some more information. Firstly This Script Mostly Works for what its purpose is however I have had some issues where the name of the part would be "CCnil" for some odd reason. I have also gotten errors saying that name is nil which is odd as I declared it already. One last thing is that the meshes don't seem to go into their supposed to be parented object and ends up where ever it ends up. Anyways I leave you to it.
--Dont Forget is was made by Angels_Develop
local PrimaryHuntingObject = 'Insert Object Here'
Script = {}
primary = nil
function GetDetails(part,nam)
local name = nam
local parent = tostring(part.Parent:GetFullName())
local String = name
local PartType = part.className
if part:IsA("BasePart") and not part:IsA("Model") then
local anchored = tostring(part.Anchored)
local color = tostring(part.BrickColor)
local material = tostring(part.Material)
local reflectancy = tostring(part.Reflectance)
local CanCollide = tostring(part.CanCollide)
local Transparency = tostring(part.Transparency)
local cframe = "CFrame.new(" .. tostring(part.CFrame) .. ")"
local Size = "Vector3.new(" .. tostring(part.Size) .. ")"
Script[#Script + 1] = (" local " .. String .. " = Instance.new( '" .. PartType .. "' , " .. parent .. " ) ; " .. String .. ".Name = '" .. name .. "' ; " .. String .. ".Anchored = " .. anchored .. " ; " .. String .. ".CanCollide = " .. CanCollide .. " ; " .. String .. ".Transparency = " .. Transparency .. " ; ".. String .. ".Shape = " .. tostring(part.Shape) .. " ; " .. String .. ".Reflectance = " .. reflectancy .. " ; " .. String .. ".BrickColor = " .. "BrickColor.new( '" .. color .. "' )" .. " ; " .. String .. ".Material = " .. material .. " ; " .. String .. '.Size = ' .. Size .. ' ; ' .. String .. ".CFrame = " .. cframe .. " ; " .. "BackSurface = " .. tostring(part.BackSurface) .. " ; " .. "BottomSurface = " .. tostring(part.BottomSurface) .. " ; " .. "FrontSurface = " .. tostring(part.FrontSurface) .. " ; " .. "LeftSurface = " .. tostring(part.LeftSurface) .. " ; " .. "RightSurface = " .. tostring(part.RightSurface) .. " ; " .. "TopSurface = " .. tostring(part.TopSurface) .. " ; ")
if primary == nil and part:IsA("Part") or part:IsA("UnionOperation") then
primary = part
Script[#Script + 1] = parent .. ".PrimaryPart = " .. parent .. "." .. name .. " ; "
end
elseif part:IsA("Model") then
Script[#Script + 1] = (" local " .. String .. " = Instance.new('Model', " .. parent .. ") ; " .. String .. ".Name = '" .. name .. "' ; ")
elseif part:IsA('CylinderMesh') or part:IsA('BlockMesh') or part:IsA('SpecialMesh') then
local Offset = "Vector3.new(" .. tostring(part.Offset) .. ")"
local scale = "Vector3.new(" .. tostring(part.Scale) .. ")"
local VertexColor = "Vector3.new(" .. tostring(part.VertexColor) .. ")"
Script[#Script + 1] = (" local " .. String .. " = Instance.new(" .. PartType .. ", " .. parent .. ") ; " .. String .. ".Name = " .. name .. " ; " .. String .. ".Offset = " .. Offset .. " ; " .. String .. ".Scale = " .. scale .. " ; " .. String .. ".VertexColor = " .. VertexColor .. " ; ")
end
end
function get(object)
GetDetails(object)
for i, v in next, object:GetChildren() do
v.Name = 'CC' .. #Script + 1
GetDetails(v, v.Name)
get(v)
end
end
get(PrimaryHuntingObject)
PrimaryHuntingObject:Destroy()
local TheScript = ""
for i, v in next, Script do
TheScript = TheScript .. v
end
print(TheScript)

2 comments
Ok jesus.
o m g