Hello, I am trying to make a 6 button plus/minus system to change the color of a block by individually changing the RBG values in increments. I got “something” to work but it increments up or down way over than what it’s suppose to and also changes the other values as well. How would I fix this? You can see in the pictures it shows the RBG of the block next to it, after clicking to increase red, it also changes blue?
button = script.Parent.Buttons
part = script.Parent.TestPiece
currentcolor = part.Color
function onClickedRup()
part.Color = Color3.new(currentcolor.R + .1,currentcolor.G,currentcolor.R)
wait()
end
function onClickedRdown()
part.Color = Color3.new(currentcolor.R - .1,currentcolor.G,currentcolor.B)
wait()
end
function onClickedGup()
part.Color = Color3.new(currentcolor.R,currentcolor.G + .1,currentcolor.B)
wait()
end
function onClickedGdown()
part.Color = Color3.new(currentcolor.R,currentcolor.G - .1,currentcolor.B)
wait()
end
function onClickedBup()
part.Color = Color3.new(currentcolor.R,currentcolor.G,currentcolor.B + .1)
wait()
end
function onClickedBdown()
part.Color = Color3.new(currentcolor.R,currentcolor.G,currentcolor.B - .1)
wait()
end
button.RincreaseButton.ClickDetector.MouseClick:connect(onClickedRup)
button.RdecreaseButton.ClickDetector.MouseClick:connect(onClickedRdown)
button.GincreaseButton.ClickDetector.MouseClick:connect(onClickedGup)
button.GdecreaseButton.ClickDetector.MouseClick:connect(onClickedGdown)
button.BincreaseButton.ClickDetector.MouseClick:connect(onClickedBup)
button.BdecreaseButton.ClickDetector.MouseClick:connect(onClickedBdown)
Color3.new() accepts numbers from 0 to 1 only, not 0 to 255 which is what you want. Use Color3.fromRGB() since this will accept 0 to 255 as it RGB range
But I’ve tried fromRGB before and had just about the same result? I’m going to try fixing the currentcolor variable to be local so it updates then I’ll see if there’s a change to using fromRGB