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

Can Someone Help With OnClicked?

This script is made to change a SurfaceGUI from a lighter color is a brighter color. It's not working. (Yeah I know OOOOOoooOO) And nothing is showing up in the Output. Please help!

function OnClicked() 
	GreenLightBox.GreenLightSG.GreenLightAndText.BackgroundColor3 = "57, 113, 100"

script.Parent.ClickDetector.MouseClick:connect(OnClicked) 
end

1 answer

function OnClicked() 
	GreenLightBox.GreenLightSG.GreenLightAndText.BackgroundColor3 = Color3.new(57, 113, 100)
end
script.Parent.ClickDetector.MouseClick:connect(OnClicked) 

You accidentally put the connection in the wrong place. EDIT: Fixed color3

5 comments

0

Erm, it still dose not work... Maybe something with the color3?

0

The output says: 18:05:40.548 - Workspace.Part.OnClicked:2: attempt to index global 'GreenLightBox' (a nil value) 18:05:40.548 - Stack Begin 18:05:40.549 - Script 'Workspace.Part.OnClicked', Line 2 18:05:40.549 - Stack End 18:05:40.550 - Disconnected event because of exception

0

Fixed!

0

Color3.new's arguments are in the range [0, 1] not [0, 255] and have to be scaled accordingly

0

Are you sure? Because [0, 255] works fine for me in a script I made awhile back... Odd...

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