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

Script changes ImageColor3 to White instead of the specified color?

Asked by
Vid_eo 126
6 years ago
Edited 6 years ago

This script I made changes ImageColor3 to White instead of the specified color? I tried this with multiple other colors; it still does the same thing. ImageColor3 is a valid property of the ImageButton.


while wait() do for i,v in pairs (script.Parent.Parent.Parent.Parent.Parent.Parent:WaitForChild("dancesGui").dancesFrame.danceFrame.danceScrolling:GetChildren()) do if v.Name == script.Name then script.Parent.itemOwnedValue.Value = true end end if script.Parent.itemOwnedValue.Value == true then script.Parent.buyButton.Text = "Purchased" script.Parent.ImageColor3 = Color3.new(0, 0, 213) -- Color changes end end

1 answer

Log in to vote
1
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago
Edited 6 years ago

Color3.new takes values from 0 to 1.

Your code returns error because you put Color3.new(0, 0, 213);

The proper format of Color3.new() is value/255, value/255, value/255

We are allowed to put either 0 or 1 because the value begins from 0 and ends at 1. For other numbers such as 213 as you specified, you have to divide it by 255 to receive the actual colour.

Hence,

Color3.new(0, 0, 213/255)

If it is hard for you to understand, consider changing it to Color3.fromRGB(0, 0, 213);

Furthermore, please write your code in the Codeblock. When you press Edit, you will see a blue logo with Lua as its title. We call that a Codeblock and that is the place where we put our script to make it readable.

0
Oh, I thought I wrote it in codeblock. I was in a rush when typing this. Thanks Vid_eo 126 — 6y
Ad

Answer this question