generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Fading Brick Colors

Previous Thread :: Next Thread 
SpryKirby is online. SpryKirby
Joined: 22 Mar 2016
Total Posts: 78
20 Jun 2017 06:39 AM
How can I make a script in such a way that a brick can smoothly fade into a new color.
Report Abuse
tball146 is not online. tball146
Joined: 02 Apr 2013
Total Posts: 363
20 Jun 2017 06:59 AM
ive had questions about this too but i do not know

plus its not that interesting anymore to me
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
20 Jun 2017 07:03 AM
This is possible.
This is easy.

All you need to do is use BrickColor.new(Color3.new(r,g,b)) with your lerp. It certainly won't be totally smooth but it is possible.

...like so:

local part = script.Parent
local oldColor = part.BrickColor
local destination = BrickColor.new("Pastel yellow") -- example
for i = 0,1,1/200 do -- over a couple hundred steps
part.BrickColor = BrickColor.new(part.BrickColor.Color:lerp(destination.Color,i))
wait()
end

A better way to do this, would be to log every unique brickcolor, and smoothly lerp those to avoid "jumps"

local part = script.Parent
local oldColor = part.BrickColor
local destination = BrickColor.new("Pastel yellow")
wait(2)
local colors = {}
for i = 0,1,1/1000 do -- make sure we get every step in there
newColor = BrickColor.new(part.BrickColor.Color:lerp(destination.Color,i))
if #colors~=nil and colors[#colors] ~= newColor then
table.insert(colors,newColor)
end
end
for _,v in next,colors do
part.BrickColor = v
wait(2/#colors) -- how fast you want to cycle through these colors, in this case 2 seconds
end
newColor = BrickColor.new(part.BrickColor.Color:lerp(destination.Color,i))
if color[#colors] and color[#colors] ~= newColor then
table.insert(colors,newColor)
end
end
for _,v in next,colors do
part.BrickColor = v
wait(2/#colors) -- how fast you want to cycle through these colors, in this case 2 seconds
end

Even still, you can use GUIs on the surface of the part. If the part is SmoothPlastic, this will work great.

local part = script.Parent
local destination = Br#####################ellow")
local guis = {}

for i = 0,5 do
local gui = Instance.new("SurfaceGui",part)
gui.Adornee = part
gui.Face = i
local frame = Instance.new("Frame",gui)
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundColor3 = part.BrickColor.Color
frame.BorderSizePixel = 0
table.insert(guis,frame)
end
for i = 0,1,1/300 do -- over 300 steps
for _,frame in next,guis do
frame.BackgroundColor3 = part.BrickColor.Color:lerp(destination.Color,i)
end
wait()
end
part.BrickColor = destination
for _,frame in next,guis do
frame.Parent:Destroy()
end



--
To avoid chops, you could lerp every color to grey, and then lerp from grey, to your desired color.

I STRONGLY recommend trying that.


Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
20 Jun 2017 07:16 AM
"use BrickColor.new(Color3.new(r,g,b))"


Sometimes I wonder if I'm the only one who looks into things rather than blindly using them.

BrickColor.new(r, g, b)

http://wiki.roblox.com/index.php?title=BrickColor


Report Abuse
Vyxinph is not online. Vyxinph
Joined: 03 May 2017
Total Posts: 12046
20 Jun 2017 07:20 AM
hi there
Report Abuse
SpryKirby is online. SpryKirby
Joined: 22 Mar 2016
Total Posts: 78
20 Jun 2017 07:52 AM
@Soybeen TYSM! Can't wait to try!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image