Okay but like why make this paid bruh? Isn’t this just cloning the element, changing the ZIndex to be behind and adding a completely black (or whatever color) UIGradient to it with some transparency?? UIGradient can do stuff like change emoji color on text, I assume you are just using that
this is literally all that is required to achieve this effect…
and takes like 20 seconds to make and can be easily streamlined
edit: wrote some code to streamline this, I even add it to a frame called DropShadowParent like your plugin does, and this code is free for everyone
The following script should be run in the command bar or in a plugin context, as it uses the Selection
service to get currently selected objects. USE_ZINDEX
specifies that the shadow should be at a lower ZIndex then the parent. This has to push the other parents back/forward so that the shadow won’t paint behind other objects in the selection. This just multiplies the ZIndex by 2, so dividing by 2 will give you the original ZIndex. If this property is set to false
, then the shadow will rely off of the “last-in-first-out” order, meaning objects that newly added objects will be painted over objects that were added previously. It is not recommended to rely off of this behavior, but if you want to, you have the option. Another option that you have is USE_REPARENTING
, the ability to make the object itself a parent of the shadow. Doing this means you don’t have to worry about ZIndex at all. (the object needs to be a parent of the shadow, because if it was the other way around, the shadow would paint on top of the object, rather than behind it.) If you do run this, everything in your selection must share the same parent object.
local DROP_SHADOW_OFFSET = UDim2.new(0, 3, 0, 3)
local DROP_SHADOW_COLOR = Color3.new(0, 0, 0)
local DROP_SHADOW_TRANSPARENCY = 0.5
local USE_REPARENTING = false
local USE_ZINDEX = true
local selectionContents = game:GetService("Selection"):Get()
local selectionParent = selectionContents[1].Parent
if #selectionContents ~= 0 then
local containerFrame = Instance.new("Frame")
containerFrame.Size = UDim2.new(1, 0, 1, 0)
containerFrame.BackgroundTransparency = 1
containerFrame.Name = "DropShadowParent"
local allParentsOk = true
for i = 1, #selectionContents do
if selectionContents[i].Parent ~= selectionParent then
warn("All selected GuiObjects must share the same parent!")
allParentsOk = false
end
end
if allParentsOk then
for i = 1, #selectionContents do
local targetObject = selectionContents[i]
if targetObject:IsA("GuiObject") then
local targetClone = targetObject:Clone()
targetClone.Name = targetClone.Name .. "_Shadow"
if targetClone:FindFirstChildOfClass("UIGradient") then
warn("Existing UIGradient found on clone of " .. targetObject:GetFullName() .. ", replacing with shadow gradient.")
targetClone:FindFirstChildOfClass("UIGradient"):Destroy()
end
local gradient = Instance.new("UIGradient", targetClone)
gradient.Color = ColorSequence.new(DROP_SHADOW_COLOR)
gradient.Transparency = NumberSequence.new(DROP_SHADOW_TRANSPARENCY)
targetClone.Parent = containerFrame
targetClone.Position = targetObject.Position + DROP_SHADOW_OFFSET
if USE_REPARENTING then
targetObject.Position = -DROP_SHADOW_OFFSET
targetObject.Parent = targetClone
else
targetObject.Parent = containerFrame
if USE_ZINDEX then
targetClone.ZIndex = targetObject.ZIndex * 2 - 1
targetObject.ZIndex = targetObject.ZIndex * 2
end
end
end
end
if #containerFrame:GetChildren() ~= 0 then
containerFrame.Parent = selectionParent
else
warn("No valid GuiObjects were selected! Please select GuiObject(s) and run this script again.")
containerFrame:Destroy()
end
end
else
warn("Nothing was selected! Please select GuiObject(s) and run this script again.")
end
edit: this may not be the best solution, but hey, it’s free