Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Smooth Color Changing? [closed]

Asked by 8 years ago

Heya Guys! I have noticed in games in such when a Surface Gui/Brick Changes color it does it smoothly, what aspect in scripting is that?

Closed as Not Constructive by M39a9am3R, Tigerism, ChemicalHex, and User#5978

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 8 years ago

You can do all sorts of things. I'll give you some code I used recently to make a TextButton's BackgroundColor change from black to white:

local data = script.Parent
local reset = false
local r = 0
local g = 0
local b = 0

while true do
    wait(.005)
    if reset == false then
        r,g,b = r + 5,g + 5,b + 5
        data.BackgroundColor3 = Color3.new(r/255,g/255,b/255)
    end
    if r == 255 then
        reset = true
    end
    if reset == true then
        r,g,b = r - 5,g - 5,b - 5
        data.BackgroundColor3 = Color3.new(r/255,g/255,b/255)
    end
    if r == 0 then
        reset = false
    end
end 

This goes in a script inside the gui object.

Comment if you need help :P

Ad
Log in to vote
-2
Answered by 8 years ago

Well you can try all different types of function for that like, -while true do -for i -etc.. Try looking on the ROBLOX Wiki up vote and accept if this helped.