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

My script isn't working, can anyone help me?

Asked by 7 years ago
Edited 7 years ago
ATransparency = ChoiceA.BackgroundTransparency
    BTransparency = ChoiceB.BackgroundTransparency
    while BlackScreen.BackgroundColor3 < Color3.new(5, 5, 5) do
        for i = 1, 10 do
            wait(0)
ATransparency = ATransparency - 0.1
        end
        for i = 1, 10 do
            wait(0)
            BTransparency = BTransparency - 0.1
        end
    end

When BlackScreen.BackgroundColor3 < Color3.new(5, 5, 5), ChoiceA and ChoiceB's BackgroundTransparency should minus 0.1, 10 times every 0 seconds. When the BlackScreen.BackgroundTransparency was equal to Color3.new(2, 2, 2) which is less then Color3.new(5, 5, 5), it didn't cause ChoiceA and ChoiceB BackgroundTransparency to minus 0.1, 10 times, every 0 seconds.

I don't know what the problem is with this script

when BlackScreen's BackgroundColor3 is less then 5, 5, 5 ChoiceA and ChoiceB BackgroundTransparency should minus 0.1, 10 times, every 0 seconds, and eventually get to 0.

I tested it, and when BlackScreen's BackgroundColor3 was less than 5, 5, 5, ChoiceA and ChoiceB's BackgroundTransparency didn't minus 0.1, 10 times, every 0 seconds.

What is the problem in this script?

ATransparency = ChoiceA.BackgroundTransparency
    BTransparency = ChoiceB.BackgroundTransparency
    while BlackScreen.BackgroundColor3 < Color3.new(5, 5, 5) do
        for i = 1, 10 do
            wait(0)
ATransparency = ATransparency - 0.1
        end
        for i = 1, 10 do
            wait(0)
            BTransparency = BTransparency - 0.1
        end
    end
0
Please edit this post and put your code in a 'code block' (Lua Logo) so we can further help you. UnleashedGamers 257 — 7y
0
How do you put it in a code block? dakanji123 97 — 7y
0
USE A MORE DESCRIPTIVE TITLE! M39a9am3R 3210 — 7y
0
Updated for code blocks. M39a9am3R 3210 — 7y
View all comments (3 more)
0
Press the little lua button and put the code inbetween the two "~~~~~" lines dragonkeeper467 453 — 7y
0
I did it dakanji123 97 — 7y
0
You were no help whatsoever M39a9am3R. I doubt you even knew how to help. dakanji123 97 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Check out the API for Color3 -- specifically, its values range from 0 to 1. The alternative is to use fromRGB which uses integers from 0 to 255. Also note that you cannot compare colors like you are doing in your while loop -- you can, compare their individual elements (ex color1.r < color2.r and color1.g < color2.g and color1.b < color2.b

Also note that ATransparency = ChoiceA.BackgroundTransparency saves the current BackgroundTransparency to ATransparency; when you change ATransparency later, it won't impact ChoiceA at all. You need to assign to ChoiceA.BackgroundTransparency to make a difference there.

Minor note: wait(0) is the same as wait()

Also, you might want to use only one for loop -- otherwise, the BackgroundTransparency will decrease for ChoiceA and then, when it's done, the BackgroundTransparency for ChoiceB will decrease. (If that's what you want then that's fine.)

0
Thanks, that helped alot! dakanji123 97 — 7y
0
How do you use FromRGB? dakanji123 97 — 7y
0
How do you use FromRGB? dakanji123 97 — 7y
0
ex, a red color would be "Color3.fromRGB(255, 0, 0)". This gives the identical result as to saying "Color3.new(1, 0, 0)" chess123mate 5873 — 7y
Ad

Answer this question