Help with a rainbow outline?

I am trying to make a rainbow outline and gui

I tried using the same script I used for the Brick

8 Likes

Do you have the outline on there? If so, please say the script you have and we can help you

yes I have an outline,
and this is the script:
local t = 5;

while wait() do
local hue = tick() % t / t
local color = Color3.fromHSV(hue,1,1)
script.Parent.Color = color
end

it works fine on parts, but I need a script for SelectionBox, and UIGradient

What do you mean by selection box?

outline, a selection box is an outline

How’s this?


demo.rbxl (24.4 KB)

To do the rainbow effect on the selection box you need to change it’s color3 property where textlabels you need to change the textcolor3, so i made a function to make each properties color rainbow.

The code would be the following:

local part = script.Parent
local selectionBox = part.SelectionBox

local billboardGui = part.BillboardGui
local textLabel = billboardGui.TextLabel

local t = 5;

function rainbowEffect(itemToBeColored, property)
	coroutine.wrap(function()
		while wait() do
			local hue = tick() % t / t
			local color = Color3.fromHSV(hue,1,1)
			itemToBeColored[property] = color
		end
	end)()
end

rainbowEffect(selectionBox, "Color3")
rainbowEffect(textLabel, "TextColor3")
4 Likes

If you want to make Rainbow for that GUI
Insert into TextLabel A UIGradient and LocalScript and in LocalScript put this

local RS = game:GetService("RunService")

local rainbow = script.Parent  -- GUI object
local grad = rainbow.UIGradient

local counter = 0       -- phase shift 
local w = math.pi / 12  -- frequency 
local CS = {}           -- colorsequence table
local num = 15             -- number of colorsequence points (maxed at 15 or 16 I believe)
local frames = 0        -- frame counter, used to buffer if you want lower framerate updates

RS.Heartbeat:Connect(function()
    if math.fmod(frames, 2) == 0 then
        for i = 0, num do
            local c = Color3.fromRGB(127 * math.sin(w*i + counter) + 128, 127 * math.sin(w*i + 2 * math.pi/3 + counter) + 128, 127*math.sin(w*i + 4*math.pi/3 + counter) + 128)
            table.insert(CS, i+1, ColorSequenceKeypoint.new(i/num, c))
        end
        grad.Color = ColorSequence.new(CS)
        CS = {}
        counter = counter + math.pi/40
        if (counter >= math.pi * 2) then
            counter = 0
        end
    end
    if frames >= 1000 then
        frames = 0
    end
    frames = frames + 1
end)
2 Likes