Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Credit Rerumu for introducing me to this technique.
- cc. 2018
- ]]
- local Objects, Types = {}, {Color3 = Color3.new();CFrame = CFrame.new();Vector2 = Vector2.new();Vector3 = Vector3.new();BrickColor = BrickColor.new();Rect = Rect.new();UDim = UDim.new();UDim2 = UDim2.new();NumberRange = NumberRange.new(0,0);NumberSequenceKeypoint = NumberSequenceKeypoint.new(0,0,0);NumberSequence = NumberSequenceKeypoint.new(0,0,0);ColorSequenceKeypoint = ColorSequenceKeypoint.new(0, Color3.new());ColorSequence = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.new());ColorSequenceKeypoint.new(1, Color3.new());})};
- local Classes do
- for i = 1, 10 do
- local Loaded = pcall(function()
- Classes = game:HttpGet('http://anaminus.github.io/rbx/json/api/latest.json', true)
- end)
- if Loaded then
- Classes = game.HttpService:JSONDecode(Classes);
- break
- else
- wait(3/10)
- end
- end
- end
- for __ = 1, #(Classes) do
- local Value = Classes[__]
- if (Value.type == 'Class') then
- Objects[Value.Name] = Value;
- Objects[Value.Name]['Properties'] = {};
- elseif (Value.type == 'Property') then
- local Ignore do
- for _, T in next, (Value.tags) do
- if (T == 'deprecated')or (T == 'hidden') then
- Ignore = true
- break
- end
- end
- end
- if (not Ignore) then
- local Props = Objects[Value.Class].Properties
- Props[#Props + 1] = Value
- end
- end
- end
- local Instance = Instance
- Instance = { new = Instance.new;
- fake = function(ClassName, Parent)
- local Ret, Recurse = {};
- Recurse = function(class)
- local Class = Objects[class]
- if Class then
- for __, Prop in next, (Class.Properties) do
- if not Ret[Prop.Name] then
- if Types[Prop.ValueType] then
- Ret[Prop.Name] = Types[Prop.ValueType]
- elseif (Prop.ValueType == 'bool') then
- if (Prop.Default) then
- Ret[Prop.Name] = (Prop.Default:match('true') and true) or false
- else
- Ret[Prop.Name] = false
- end
- elseif (Prop.ValueType == 'float') or (Prop.ValueType == 'int') then
- if (Prop.Default) then
- Ret[Prop.Name] = tonumber(Prop.Default) or 0
- else
- Ret[Prop.Name] = 0
- end
- elseif (Prop.ValueType == 'string')then
- if (Prop.Default) then
- Ret[Prop.Name] = Prop.Default
- else
- Ret[Prop.Name] = ''
- end
- end
- end
- end
- if Class['Superclass'] then
- Recurse(Class['Superclass'])
- end
- end
- end
- Recurse(ClassName)
- Ret['ClassName'] = ClassName
- if Parent then
- Ret['Parent'] = Parent
- end
- return setmetatable(Ret, {
- --__metatable = getmetatable(game);
- __call = function(Props)
- for Name, Val in next, (self, Props) do
- Ret[Name] = Val
- end
- return Ret
- end
- })
- end
- }
- -- EXAMPLE -- (Works Exactly Like Create But Better)
- local I = Instance.fake('StringValue', workspace){
- Name = 'Value',
- Value = '',
- }
- print(I)
- ------------
Add Comment
Please, Sign In to add comment