GUI Ripple Effect

local RippleEffect = {}

function RippleEffect.AddEffect(UIInstance,Mouse,Duration,Color)

local function Tween(Obj,Goal)

game:GetService("TweenService"):Create(Obj,TweenInfo.new(Duration),Goal):Play()

end

local ASX,ASY = UIInstance.AbsoluteSize.X, UIInstance.AbsoluteSize.Y

local APX,APY = UIInstance.AbsolutePosition.X, UIInstance.AbsolutePosition.Y

local MX,MY = Mouse.X,Mouse.Y

local Pos = UDim2.new(0,MX-APX,0,MY-APY)

local UBC3 = UIInstance.BackgroundColor3

local UR,UG,UB = UBC3.R, UBC3.G, UBC3.B

local UI = Instance.new("Frame",UIInstance)

UI.BackgroundColor3 = Color

UI.Name = "Ripple"

UI.ZIndex = 100001

local Corner = Instance.new("UICorner",UI)

Corner.CornerRadius = UDim.new(1,0)

UI.AnchorPoint = Vector2.new(0.5,0.5)

UI.Position = Pos

local MS = UDim2.fromOffset(math.max(ASX,ASY),math.max(ASX,ASY))

UI:TweenSize(MS,"Out","Sine",Duration)

Tween(UI,{BackgroundTransparency = 1})

wait(Duration)

UI:Destroy()

end

return RippleEffect

here sorry for the delay!

4 Likes