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

Why is setting a gui's backroundcolor3 to a color3 value not working?

Asked by 3 years ago
Edited 3 years ago

I am trying to make a gui text label's background color flash from white to black but it seems to not be changing my color. Here is the local script's code:

local data = script.Parent.Parent.Parent.data
local started = data.STARTED
started = false
while started == false do
    print("started")
    data.Parent.flasher.BackgroundColor3 = Color3.new(255, 255, 255)
    print(data.Parent.flasher.Parent.Parent)
    wait(0.5)
    data.Parent.flasher.BackgroundColor3 = Color3.new(0,0,0)
end

I am sure the loop is working as I added a print and that works. Update the backroundcolo3 value gets insanely multiplied

3 answers

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
3 years ago

the R, G and B components of Color3 are ranged 0-1. Do Color3.new(255/255, 255/255, 255/255)

Ad
Log in to vote
0
Answered by
I_Nev 200 Moderation Voter
3 years ago

I used to have this issue aswell, use Color3.FromRGB() it works good for this

local data = script.Parent.Parent.Parent.data
local started = data.STARTED
started = false
while started == false do
    print("started")
    data.Parent.flasher.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    print(data.Parent.flasher.Parent.Parent)
    wait(0.5)
    data.Parent.flasher.BackgroundColor3 = Color3.fromRGB(0,0,0)
end

Let me know if this helps you ~nevan

Log in to vote
0
Answered by 3 years ago

Use Color3.fromRGB instead of Color3.new

Answer this question