Advertisement
Vzurxy

create func

Aug 3rd, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local function create(instanceType)
  2.     return function(data)
  3.         local obj = new(instanceType)
  4.         for k, v in pairs(data) do
  5.             do
  6.                 local s, e = pcall(function()
  7.                     if type(k) == "number" then
  8.                         v.Parent = obj
  9.                     elseif type(v) == "function" then
  10.                         obj[k]:Connect(v)
  11.                     else
  12.                         obj[k] = v
  13.                     end
  14.                 end)
  15.                 if not s then
  16.                     error("Create: could not set property " .. k .. " of " .. instanceType .. " (" .. e .. ")", 2)
  17.                 end
  18.             end
  19.         end
  20.         return obj
  21.     end
  22. end
  23.  
  24. local loadingIcon = create("ImageLabel")({
  25.     Name = "Disc",
  26.     BackgroundTransparency = 1,
  27.     ImageTransparency = 1,
  28.     Image = "rbxassetid://2984940561",
  29.     SizeConstraint = Enum.SizeConstraint.RelativeYY,
  30.     Size = udim2(0.35, 0, 0.35, 0),
  31.     AnchorPoint = vec2(0.5, 0.5),
  32.     Position = udim2(0.5, 0, 0.5, 0),
  33.     Rotation = 180,
  34.     ZIndex = 11,
  35.     Parent = gui
  36. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement