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
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.
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.