Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fullname(input)
- if input then
- if input.Parent == game then
- return 'game:GetService"'..input.ClassName..'"'
- end
- local result = input.Name
- input = input.Parent
- repeat wait()
- if input then
- if input.Parent == game then
- result = "game:GetService'"..input.Name.."'." .. result
- else
- result = input.Name .. '.' .. result
- end
- input = input.Parent
- end
- until input == game
- return result
- end
- end
- local tableToString
- local datatypes = {}
- datatypes.string = function(input)
- return '"' .. tostring(input) .. '"'
- end
- datatypes.number = function(input)
- return tostring(input)
- end
- datatypes.boolean = function(input)
- return datatypes.number(input)
- end
- datatypes.EnumItem = function(input)
- return datatypes.number(input)
- end
- datatypes.table = function(input)
- return tableToString(input)
- end
- datatypes.Color3 = function(input)
- local r = tostring(input.R*255)
- local g = tostring(input.G*255)
- local b = tostring(input.B*255)
- return 'Color3.fromRGB(' .. r .. ', ' .. g .. ', ' .. b .. ')'
- end
- datatypes.ColorSequenceKeypoint = function(input)
- return 'ColorSequenceKeypoint.new(' .. input.Time .. ', ' .. datatypes.Color3(input.Value) .. ')'
- end
- datatypes.ColorSequence = function(input)
- local output = 'ColorSequence.new({'
- local keypoints = input.Keypoints
- for a,keypoint in pairs(keypoints) do
- output = output .. datatypes.ColorSequenceKeypoint(keypoint)
- if #keypoints > 1 and a < #keypoints then
- output = output .. ', '
- end
- end
- output = output .. '})'
- return output
- end
- datatypes.NumberSequenceKeypoint = function(input)
- return 'NumberSequenceKeypoint.new(' .. input.Time .. ', ' .. input.Value .. ')'
- end
- datatypes.NumberSequence = function(input)
- local output = 'NumberSequence.new({'
- local keypoints = input.Keypoints
- for a,keypoint in pairs(keypoints) do
- output = output .. datatypes.NumberSequenceKeypoint(keypoint)
- if #keypoints > 1 and a < #keypoints then
- output = output .. ', '
- end
- end
- output = output .. '})'
- return output
- end
- datatypes.NumberRange = function(input)
- return 'NumberRange.new('..input.Min..', '..input.Max..')'
- end
- datatypes.UDim = function(input)
- return 'UDim.new(' .. tostring(input.Scale) .. ', ' .. tostring(input.Offset) .. ')'
- end
- datatypes.UDim2 = function(input)
- return 'UDim2.new(' .. tostring(input.X) .. ', ' .. tostring(input.Y) .. ')'
- end
- datatypes.Vector2 = function(input)
- return 'Vector2.new(' .. tostring(input) .. ')'
- end
- datatypes.Vector3 = function(input)
- return 'Vector3.new(' .. tostring(input) .. ')'
- end
- datatypes.Rect = function(input)
- return 'Rect.new(' .. tostring(input) .. ')'
- end
- datatypes.CFrame = function(input)
- return 'CFrame.new(' .. tostring(input) .. ')'
- end
- datatypes.BrickColor = function(input)
- return 'BrickColor.new("'..tostring(input)..'")'
- end
- datatypes.Faces = function(input)
- local output = 'Faces.new('
- input = tostring(input)
- local ids = {'Back', 'Front', 'Top', 'Bottom', 'Left',' Right'}
- for a,id in pairs(ids) do
- input = input:gsub(id, 'Enum.NormalId'..id)
- end
- output = output .. input .. ')'
- return output
- end
- datatypes.Instance = function(input)
- return fullname(input)
- end
- function x1(value)
- local tof = typeof(value)
- if datatypes[tof] then
- return datatypes[tof](value)
- else
- return tostring(value)
- end
- end
- tableToString = function(t, bool)
- local result = '' if not bool then result = '{' end
- for a,b in pairs(t) do
- if a and b then
- result ..= x1(b)
- if #t > 1 and a < #t then
- result ..= ', '
- end
- end
- end
- if not bool then result ..= '}' end
- return result
- end
- return tableToString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement