Hello, I’m currently working on a overhead tag editor:
I’ve been trying to set it so when you click on a gradient you want, it will fire a remote to the server so that it’ll update the text labels in the tag to that gradient color, as well as animate it with a ‘shine’ effect that I have stumbled upon from a tutorial posted up on the forums.
My main problem is handling the colors set from the UIGradient to the server so that whatever preset you select, it will apply it to the textlabels with the animation.
I’ve written the majority of the code already, just not sure how to handle that particular case.
ClientScript: (This also includes animating the TextButton itself) [INCOMPLETE]
local button = script.Parent
local gradient = button.UIGradient
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out)
local offset1 = {Offset = Vector2.new(1, 0)}
local create = ts:Create(gradient, ti, offset1)
local startingPos = Vector2.new(-1, 0) --start on the right, tween to the left so it looks like the shine went from left to right
local addWait = 2.5 --the amount of seconds between each couplet of shines
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeGradient = ReplicatedStorage.Remotes.ChangeGradient
gradient.Offset = startingPos
local function animate()
create:Play()
create.Completed:Wait() --wait for tween to stop
gradient.Offset = startingPos --reset offset
create:Play() --play again (I did this only 2 times per "couplet", you can do it more times if you want)
create.Completed:Wait()
gradient.Offset = startingPos
wait(addWait) --wait some bit before the next couplet
animate() --call itself to make this into a loop
end
animate() --but we still need to initially call it
button.Activated:Connect(function()
print("This has been selected")
local gradient = button.UIGradient
changeGradient:FireServer(gradient)
end)
Both parts of the server which handle the remote as well as the function to apply the gradients
changeGradient.OnServerEvent:Connect(function(player, gradselect)
local rank = player:GetRankInGroup(Configurations.GROUP_ID)
local rank1 = (rank == 253)
local module = DataModule.OwnedGamepasses[player.UserId]
if (not module or not module[Configurations.ColoredTitles] or not rank1) then return; end
if (os.clock() - (changeCoolDown[player.UserId] or 0) > .4) then
changeCoolDown[player.UserId] = os.clock()
HeaderCreator.AnimateGradient(gradselect)
end
end)
This is the main function that applies the gradients and animates them. [INCOMPLETE]
function HeaderCreator.AnimateGradient(player, gradselect)
local char = player.Character or player.CharacterAdded:Wait()
local header = char:FindFirstChild("OverheadGui")
local titlecustom = game.StarterGui.PhoneMenu.Frame.TitleCustomization.ScrollingFrame
local gradient = gradselect
local labels, x = {}, 0
for _, inst in pairs(header:GetDescendants()) do
if (inst:IsA("TextLabel") and inst.Name ~= "Label2" and inst.Name ~= "Label4") then table.insert(labels, inst) end
end
coroutine.wrap(function()
while (header.Parent ~= nil) do
wait(.08)
for _, label in pairs(labels) do
label.TextColor3 = gradselect
x = x >= 1 and 0 or x + 1/255
end
end
end)()
end
I feel like i’m almost there, but stumped on how to handle gradient properties.
Any insight is appreciated.