So I’m trying to make a shine effect thingy GUI. it works but the problem is it doesn’t match the exact color of the UI. I don’t know but I think it doubles the color of the UI…
heres my code:
local module = {}
local TweenService = game:GetService("TweenService")
function GetUI_Type(Obj)
local NormalClass = {
"Frame",
"TextButton",
"TextLabel",
"TextBox",
}
local ImgClass = {
"ImageLabel",
"ImageButton",
}
--local function GetClassOnTbl()
for i, v in pairs(NormalClass) do
if Obj.ClassName == v then
print(v)
return "Normal"
end
end
for i, v in pairs(ImgClass) do
if Obj.ClassName == v then
print(v)
return "Image"
end
end
--end
end
function module:ShineUI(UI_Obj, Speed, Rot)
local Offset1 = Vector2.new(-1.5, 0)
local Offset2 = Vector2.new(1.5, 0)
local TempG = script.UIGradient:Clone()
TempG.Offset = Offset1
TempG.Parent = UI_Obj
TempG.Rotation = Rot or 0
local uiType = GetUI_Type(UI_Obj)
local Sequence
if uiType == "Normal" then
local Keypoints = {
ColorSequenceKeypoint.new(0, UI_Obj.BackgroundColor3),
ColorSequenceKeypoint.new(.5, Color3.fromRGB(255, 255, 255)),
ColorSequenceKeypoint.new(1, UI_Obj.BackgroundColor3)
}
Sequence = ColorSequence.new(Keypoints)
elseif uiType == "Image" then
local Keypoints = {
ColorSequenceKeypoint.new(0, UI_Obj.ImageColor3),
ColorSequenceKeypoint.new(.5, Color3.fromRGB(255, 255, 255)),
ColorSequenceKeypoint.new(1, UI_Obj.ImageColor3)
}
Sequence = ColorSequence.new(Keypoints)
else
error(UI_Obj.Name .. " is not available to shine.")
end
TempG.Color = Sequence
local TInfo = TweenInfo.new(Speed, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local Goals = {
Offset = Offset2
}
local tween = TweenService:Create(TempG, TInfo, Goals)
tween:Play()
tween.Completed:Wait()
TempG:Destroy()
end
return module
and here’s the result stuff: