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
 

Re: Editing color3 values

Previous Thread :: Next Thread 
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:07 AM
So, I have this block of code right now, with two different ways of editing color3; I'm not sure if either work.

    init = 1
    endval = 2
    increment = 0.1

    while true do
        for i = init, endval, increment do
            desig = script.Parent.Color3
            desig = Color3.new(desig.r - 0, desig.g - increment, desig.b - increment)
            wait(increment)
        end
        for i = init, endval, increment do
            desig = script.Parent.Color3
            desig = Color3.new(desig - increment, increment, 0)
            wait(increment)
        end
    --[[Assume there's an end here]] end


I'm attempting to subtract everything but the red in the first one, and bring out the blue in the second.

~>dat siggy<~
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:16 AM
Anyone home in SH?

~>dat siggy<~
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:19 AM
init = 1
endval = 2
increment = 0.1

while true do
for i = init, endval, increment do
desig = script.Parent
desig.Color3 = Color3.new(desig.r - 0, desig.g - increment, desig.b - increment)
wait(increment)
end
for i = init, endval, increment do
desig = script.Parent
desig.Color3 = Color3.new(desig - increment, increment, 0)
wait(increment)
end
--[[Assume there's an end here]] end



If you do somthing like this:
IfSit = Humanoid.Sit
then it will always remain like that, because you declare it as current value.
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:20 AM
Zars, if I put it inside the while true do, it automatically updates because it calls for the value again.

~>dat siggy<~
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:21 AM
You could try it, if nothing happens, add a wait() just below the while true do.
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:24 AM
Cheater, I actually had to do that with a couple of my scripts. I learned that if I put it outside of a loop, it only updates ONCE because it runs through that part of the script ONCE. Declaring the variable inside of the loop causes the variable the script uses to update because it is declared again.

What I'm looking at is which way to change the RGB colors.

~>dat siggy<~
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:26 AM
Why are you doing "- 0" anyway..?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:26 AM
Is it a brick? It won't work so because it's not written in hexadecimals.

I tried it with some SpecialMesh and BlockMesh etc, but even that didn't work, and Stravant told me that this should work. :/ The bricks color can't be changed from these 64 given colors. Forget it.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:27 AM
Because he needs a blue.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:27 AM
And why are you subtracting from color3 value?!

"desig - increment"
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:28 AM
@zars: I'm thinking that it might change that variable, so to be safe, I'm putting a zero there, which means it's not subtracting anything.

@Cheater: No, silly. I'm not that bad of a scripter. xD I'm working with a Frame.

~>dat siggy<~
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:29 AM
@zars (again):

Y U NO GET POINT OF CHANGING COLOR3
I BE MAKING SPECTRUM EFFECT

~>dat siggy<~
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:29 AM
(0, 0, 0) <--Black

(255, 0, 0) <--Red
(0, 255, 0) <--Green
(0, 0, 255) <--Blue

(255, 255, 0) <--Yellow
(255, 0, 255) <--Magenta
(0, 255, 255) <--Cyan

(255, 255, 255) <--White
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:30 AM
U call this as spectrum?!
attempt to perform arithmetic on a userdata value

You can't do math on Color3 -_-
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:30 AM
Was just a note.
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:30 AM
Cheater:
When working with color3's:

0-1
If you're going to make an RGB value, divide the RGB you want by 255 (e.g. 52/255 makes a Color3 that isn't defaulted to 1)

~>dat siggy<~
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:31 AM
@cheater. U doin it wrong!

(0,0,0) - Black
(1,0,0) - Red
(0,1,0) - Green
(0,0,1) - Blue


Welcome to roblox.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:31 AM
If you want to change the background, take BackgroundColor3, it worked fine for me.
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:31 AM
@zars
Explain how to get around this without using a horribly inefficient block of wait(0.1) stuff.


~>dat siggy<~
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
27 Jun 2012 06:32 AM
I know, just forgot. (like everytime)
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:32 AM
Color3.new(0/255,0/255,0/255)
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:32 AM
Just fix syntax?
desig = Color3.new(desig.r - increment, increment, 0)
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:33 AM
@zars, I want the values of G and B to decrease gradually.

~>dat siggy<~
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Jun 2012 06:34 AM
I understand but look:
"desig = Color3.new(desig - increment, increment, 0)"
-----------------------^^^^^^^^^^^^^

You can't do math on Color3 value. You should fix that.
Report Abuse
SundownMKII is not online. SundownMKII
Joined: 26 Sep 2010
Total Posts: 12880
27 Jun 2012 06:36 AM
Oi, Roblox, why must you be such a pain to script in. Can't perform math on Color3's...

I'm pasting in the new piece of code now.

~>dat siggy<~
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