Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script changes ImageColor3 to White instead of the specified color?

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

✓ Accepted answer

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

1 comment

0

Oh, I thought I wrote it in codeblock. I was in a rush when typing this. Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.