Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 2/11/2019: A F F E C T I O N --
- -- the (\n) when printed out will print (2 times ' ')
- local inp = [[]] -- paste everything in here, do not change anything from it!
- local txt = ""
- local mod = Instance.new('Model')
- local i = 1
- local dem = 0
- function c(i)
- return inp:sub(i,i)
- end
- function s(i,j)
- return inp:sub(i,j)
- end
- print('the start of an era')
- print('the input is ' ..tostring(#inp).. ' characters long')
- while i <= #inp do
- local function cc(str, i)
- return str:sub(i,i)
- end
- local function ss(str, i,j)
- return str:sub(i,j)
- end
- if c(i) == '{' then
- dem = dem + 1
- i = i + 2
- local classname = s( i, inp:find('\n', i)-1 ) -- use the \n as the basis to everything
- local obj = Instance.new( classname )
- i = i + #classname + 1 -- move the i to the next line
- local name = s( i, inp:find('\n', i)-1 )
- obj.Name = name
- i = i + #name + 1
- local colorstr = s( i, inp:find('\n', i)-1 )
- local colors = {}
- local ii = 1
- while ii <= #colorstr do -- colorstr is a small string that contains the color3
- if string.match(cc(colorstr,ii), '%d') ~= nil then -- color cannot be negative
- local l = 0
- for jj = ii, #colorstr do
- if string.match(cc(colorstr,jj), '%d') ~= nil or cc(colorstr,jj) == '.' then
- l = l + 1
- else
- break
- end
- end
- table.insert(colors, ss(colorstr,ii, ii+l-1))
- ii = ii + l + 1
- else
- ii = ii + 1
- end
- end
- obj.Color = Color3.new(unpack(colors))
- i = i + #colorstr + 1
- local material = s( i, inp:find('\n', i)-1 )
- obj.Material = Enum.Material[material]
- i = i + #material + 1
- local reflectance = s( i, inp:find('\n', i)-1 )
- obj.Reflectance = tonumber(reflectance)
- i = i + #reflectance + 1
- local transparency = s( i, inp:find('\n', i)-1 )
- obj.Transparency = tonumber(transparency)
- i = i + #transparency + 1
- local cfstr = s( i, inp:find('\n', i)-1 )
- local cfs = {}
- local ii = 1
- while ii <= #cfstr do -- cfstr is a small string that contains the vector3
- if string.match(cc(cfstr,ii), '%d') ~= nil or cc(cfstr,ii) == '-' then -- cframe could very be a negative number
- local l = 0
- for jj = ii, #cfstr do
- if string.match(cc(cfstr,jj), '%d') ~= nil or (cc(cfstr,jj) == '.' or cc(cfstr,jj) == '-' or cc(cfstr,jj) == 'e') then -- cframe numbers can sometimes be very small like 10^-n
- l = l + 1
- else
- break
- end
- end
- table.insert(cfs, ss(cfstr,ii, ii+l-1))
- ii = ii + l + 1
- else
- ii = ii + 1
- end
- end
- obj.CFrame = CFrame.new(unpack(cfs))
- i = i + #cfstr + 1
- if s(i, i+3) == "true" then
- obj.Anchored = true
- i = i + 5 -- idk why it has to be +1 but lets just follow it
- elseif s(i, i+4) == "false" then
- obj.Anchored = false
- i = i + 6
- end
- if s(i, i+3) == "true" then
- obj.CanCollide = true
- i = i + 5
- elseif s(i, i+4) == "false" then
- obj.CanCollide = false
- i = i + 6
- end
- if classname == "Part" then -- only normal parts have the shape property
- local shape = s( i, inp:find('\n', i)-1 )
- obj.Shape = Enum.PartType[shape]
- i = i + #shape + 1
- end
- local sizestr = s( i, inp:find('\n', i)-1 )
- local sizes = {}
- local ii = 1
- while ii <= #sizestr do -- sizestr is a small string that contains the vector3
- if string.match(cc(sizestr,ii), '%d') ~= nil then -- size cannot be negative
- local l = 0
- for jj = ii, #sizestr do
- if string.match(cc(sizestr,jj), '%d') ~= nil or cc(sizestr,jj) == '.' then
- l = l + 1
- else
- break
- end
- end
- table.insert(sizes, ss(sizestr,ii, ii+l-1))
- ii = ii + l + 1
- else
- ii = ii + 1
- end
- end
- obj.Size = Vector3.new(unpack(sizes))
- i = i + #sizestr + 1
- while i <= #inp do
- if c(i) == '[' then
- i = i + 2
- local classname = s( i, inp:find('\n', i)-1 )
- local mesh = Instance.new( classname )
- i = i + #classname + 1
- local name = s( i, inp:find('\n', i)-1 )
- mesh.Name = name
- i = i + #name + 1
- if classname == 'SpecialMesh' then
- local meshtype = s( i, inp:find('\n', i)-1 )
- mesh.MeshType = Enum.MeshType[meshtype]
- i = i + #meshtype + 1
- if meshtype == 'FileMesh' then
- local meshid = s( i, inp:find('\n', i)-1 )
- mesh.MeshId = meshid
- i = i + #meshid + 1
- local texid = s( i, inp:find('\n', i)-1 )
- mesh.TextureId = texid
- i = i + #texid + 1
- end
- end
- local scalestr = s( i, inp:find('\n', i)-1 )
- local scales = {}
- local ii = 1
- while ii <= #scalestr do -- scalestr is a small string that contains the vector3
- if string.match(cc(scalestr,ii), '%d') ~= nil or cc(scalestr,ii) == '-' then -- scale can sometimes be negative, if it is inside out
- local l = 0
- for jj = ii, #scalestr do
- if string.match(cc(scalestr,jj), '%d') ~= nil or (cc(scalestr,jj) == '.' or cc(scalestr,ii) == '-') then
- l = l + 1
- else
- break
- end
- end
- table.insert(scales, ss(scalestr,ii, ii+l-1))
- ii = ii + l + 1
- else
- ii = ii + 1
- end
- end
- mesh.Scale = Vector3.new(unpack(scales))
- i = i + #scalestr + 1
- mesh.Parent = obj
- break
- elseif c(i) == '}' then -- meaning that there is no sub-instances inside that obj
- break
- end
- i = i + 1 -- keep finding until the end of the obj infos
- end
- obj.TopSurface = 'Smooth'
- obj.BottomSurface = 'Smooth'
- obj.Parent = mod
- end
- i = i + 1
- end
- mod.Parent = workspace
- print('loaded ' ..tostring(dem).. ' parts')
- game:GetService('ChangeHistoryService'):SetWaypoint('WE BOUT TO MAKE HISTORY BOIS')
Add Comment
Please, Sign In to add comment