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 » Scripting Helpers
Home Search
 

Still gotta change a bit :3

Previous Thread :: Next Thread 
GiverLol is not online. GiverLol
Joined: 20 Dec 2010
Total Posts: 810
12 Jan 2013 03:26 AM
How could I make a script that changes the color of an GUI object slowly to a certain color. (Like when I trigger a function, it kinda 'moves' to the certain color.)

Thanks :3
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
12 Jan 2013 03:32 AM
[ Content Deleted ]
Report Abuse
GiverLol is not online. GiverLol
Joined: 20 Dec 2010
Total Posts: 810
12 Jan 2013 04:43 AM
Thanks :3
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
12 Jan 2013 04:54 AM
You could use Vector3 to lerp and then change it to color. Haxy, but naic :D


for num=1,100 do--I'm not using decimal numbers, since Lua likes to change them for some reason.
v = Vector3.new(beginingColor):lerp(Vector3.new(endColor),num/100)
GUI.BackgroundColor3 = Color3.new(v.x,v.y,v.z)
wait()
end



Should work nicely. Might test it out too.
Report Abuse
GiverLol is not online. GiverLol
Joined: 20 Dec 2010
Total Posts: 810
12 Jan 2013 05:08 AM
D:
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
12 Jan 2013 05:09 AM
Woof gave bad example, since in roblox you don't use values for colors between 1-255, but 0-1.
Report Abuse
GiverLol is not online. GiverLol
Joined: 20 Dec 2010
Total Posts: 810
12 Jan 2013 06:18 AM
function slide(Red, Green, Blue)


local red = math.floor(script.Parent.BackgroundColor3.r * 255)
local green = math.floor(script.Parent.BackgroundColor3.g * 255)
local blue = math.floor(script.Parent.BackgroundColor3.b * 255)

print("__________________")

if red < Red then
print("Make red bigger")
end

if red > Red then
print("Make red smaller")
end

if red == Red then
print("Keep red the same")
end

if green < Green then
print("Make green bigger")
end

if green > Green then
print("Make green smaller")
end

if green == Green then
print("Keep green the same")
end

if blue < Blue then
print("Make blue bigger")
end

if blue > Blue then
print("Make blue smaller")
end

if blue == Blue then
print("Keep blue the same")
end

print("------------------")
end

slide(137, 100, 50)
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
12 Jan 2013 08:18 AM
"script.Parent.BackgroundColor3.r * 255"



Color3 requires numbers between 0-1. If you'll set color higher than 1, it will count as 1(max).
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
12 Jan 2013 08:20 AM
Also this one worked perfectly. So if you'd want to have it go from red to blue, you'd just do this:

for num=1,100 do--I'm not using decimal numbers, since Lua likes to change them for some reason.
v = Vector3.new(1,0,0):lerp(Vector3.new(0,0,1),num/100)
GUI.BackgroundColor3 = Color3.new(v.x,v.y,v.z)
wait()
end

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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