Advertisement
BossSpaz

[EzEvent] Dropshadow

May 30th, 2021
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local CS = game:GetService("CollectionService")
  2.  
  3. local function Event(instance, attributes)
  4.     local ShadowX = attributes.ShadowX or 4
  5.     local ShadowY = attributes.ShadowY or 4
  6.     local ShadowColor = attributes.ShadowColor or Color3.fromRGB(44, 44, 44)
  7.    
  8.     -- Don't want to clone the children
  9.     for i, v in pairs(instance:GetChildren()) do
  10.         v.Archivable = false
  11.     end
  12.    
  13.     -- Create shadow
  14.     local Clone = instance:Clone()
  15.     Clone.Size = UDim2.fromScale(1, 1)
  16.     Clone.AnchorPoint = Vector2.new(0, 0)
  17.     Clone.Position = UDim2.new(0, ShadowX, 0, ShadowY)
  18.     Clone.ZIndex -= 5
  19.     Clone:SetAttribute("EzEvent", nil) -- Remove any events connected to the clone
  20.     CS:RemoveTag(Clone, "EzEvent") -- Make sure we don't accidentally do something stupid
  21.     Clone.Parent = instance
  22.    
  23.     if (Clone.ClassName:match("Image")) then
  24.         Clone.ImageColor3 = ShadowColor
  25.     else
  26.         Clone.BackgroundColor3 = ShadowColor
  27.     end
  28.    
  29.     -- Reset archivable
  30.     for i, v in pairs(instance:GetChildren()) do
  31.         v.Archivable = false
  32.     end
  33. end
  34.  
  35. return Event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement