I need to make a script that could change the ImageColour3 of an image via a button. I have tried a few other scripts but these appear to be for the wrong thing.
https://gyazo.com/1120e5694a18f4f6a97acd7f150e0523
https://gyazo.com/642a306960fa9b70552cf34e46b49d64
On your button you would want to use a MouseButton1Click event and connect it to a function that references your image and changes it based on the click. For example:
local button = script.Parent local image = script.Parent:FindFirstChild('image') button.MouseButton1Click:Connect(function() image.ImageColor3 = Color3.fromRGB(255,255,255) -- changing the color of the image to white end)
If you're trying to change the color of Unlit via the ClickDetector you need to connect a function to a MouseClick
event on that detector.
local image= script.Parent.Parent.Light.SurfaceGui.Unlit local detector = script.Parent.ClickDetector --Connecting MouseClick to the ClickDetector detector.MouseClick:Connect(function() image.ImageColor3 = Color3.fromRGB(0,0,0) -- change it your new RGB color. end)
Make sure to put it in the same place as the script you currently have.