I need help with scripting a GUI light button

So, I’ve been working on this GUI led light controller. The buttons work but the brightness of darker colours is really low and I don’t know how to script it to change the brightness. I’ve tried scripting it so it adds a spotlight of the right colour but wasn’t successful.

As you can see the darker colours weren’t bright even though there neon. And the brighter colours are more neon.

Here’s the script in the dark green button from the video. So does anyone know a script that makes it add a point light that’s the same colour of the light when the button is pressed or something?

1 Like

Colors don’t suitably translate between GUI objects and instance objects. Instead of adding a PointLight, I suggest you simply pick a lighter shade of green. Experiment with different BrickColor values. If you can’t find a fit, try changing the part’s Color3 value instead. The documentation on Color3 is in the link below.

I’ll try, thank you for your help

This should work:

--//Variables
local Button = script.Parent
local LED = workspace.Part
local LEDBrickColor = BrickColor.new("Earth green")

--//Functions
Button.MouseButton1Click:Connect(function()
	LED.BrickColor = LEDBrickColor
	
	if not LED:FindFirstChild("Light") then
		local Light = Instance.new("PointLight")
		Light.Name = "Light"
		Light.Color = LEDBrickColor.Color
		Light.Brightness = 100
		Light.Parent = LED
	else 
		LED.Light.Color = LEDBrickColor.Color
	end
end)
2 Likes

Coloring the PointLight is also a good idea. I didn’t think about that.

alright ill try it, thank you…

I just added a thing to prevent people from spamming it and creating tons of lights, you should try my revamped version.

Could you send me the link please?

I meant that I just edited my original post. Just scroll up.

So I changed it to the part names but it didn’t work

So there the part names. Do you know what I did wrong?

I don’t mean to bother you. Its just I’m not quite sure where I put “MyLedPart” and “ImageButton6” (The dark green one). It’s just I’ve nether really scripted anything like this before. Thanks for all your help though.

And just FYI Its an image button not a button

Did you reference your LED part correctly? It worked when I tried it.

When you make a color dark as neon, it won’t glow. You should probably put a script to make the neon part color brighter, or you can assign each button on your GUI into like a code or number, and use a remote event to change the neon part.

Katrist, Do you mind sending me a screenshot of your script. And a video of your working light

My script screenshot: (exact same as before)
image

Video:

@Raphael_G19 If you’re looking to change the brightness of the LED itself and not the pointlight, the max colors for RGB is obviously… well… 255,255,255. So if you wanted it completely red, do 255,0,0 and make the material neon. That’s basically all you can do.

OMG! Katrist. You did it! Thank you so much! Your a lifesaver! I can’t believe it actually worked I’ve been trying to fix this for days.

2 Likes

Theres just one more thing though

The more you press it the brighter it gets. Is there any script to make it only change once