local B = game.Workspace.part.Color.b
local G = game.Workspace.part.Color.g
local R = Value
function onClicked(playerWhoClicked)
function UpdateR(part, Value)
game.Workspace.part.Color = Color3.new(R/255, G, B)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
You have to call updateR() for it to run. You also have to define Value. Try this:
local B = game.Workspace.part.Color.b
local G = game.Workspace.part.Color.g
local R = 255 --Value you want
local function UpdateR(part)
game.Workspace.part.Color = Color3.new(R/255, G, B)
end
local function onClicked(playerWhoClicked)
UpdateR(script.Parent)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
local B = game.Workspace.clear.Color.b
local G = game.Workspace.clear.Color.g
local R = 0.5
function UpdateR(clear)
game.Workspace.clear.Color = Color3.new(R/255, G, B)
end
function onClicked(playerWhoClicked)
UpdateR(script.Parent)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Does the script have to be in the part, or can it stay in the button?
The purpose of these buttons is to change the color of the lighting. Clicking red adds red to the lighting, clicking green adds green to the lighting, and clicking blue adds blue to the lighting.
The way I had set up this effect is extremely convoluted.
Basically, there are three parts in the same position, but each has a different color pointlight. Red, green, and blue. When the “Red” button is clicked, the red pointlight is enabled. When the “Green” button is clicked, the green pointlight is enabled. So on and so forth: the colors mix.
I’m trying to implement the same effect for these “spotlights” I have. However, it’s not as simple with BrickColor, since BrickColor can’t mix like lighting can.
I did set the material of these spotlights to Plastic, so that the lighting can sorta change the color of the spotlight without interfering with BrickColor, but this often makes the spotlights seem dim, so I want to be able to use neon.
But I can’t use neon without going into BrickColor.
I hope this clears up everything. Sorry if it’s overly complicated.
No, because the colors have to mix together, and unless I’m gonna have to pull some serious “If that do this return” mess, which I seriously don’t want to do given the complexity of my button scheme, I want a script that “adds” the color to the already existing color, similar to my pointlight method, if that’s even possible in Lua.
local function Color(Prop, Value, Color)
local RGB = {R = Color.R, G = Color.G, B = Color.B}
RGB[Prop:upper()] = Value
return Color3.fromRGB(unpack(RGB))
end
RedButton.MouseClick:Connect(function()
Part.Color = Color('R', 255, Part.Color)
end)
Idk did u want something like this? When u click the red button, it changes the Color.R to whatever color u chose? @HereComeDatEli