Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can Someone Help With OnClicked?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago
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

0
Erm, it still dose not work... Maybe something with the color3? Leg0brick 10 — 9y
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 Leg0brick 10 — 9y
0
Fixed! notRezznov 35 — 9y
0
Color3.new's arguments are in the range [0, 1] not [0, 255] and have to be scaled accordingly BlueTaslem 18071 — 9y
0
Are you sure? Because [0, 255] works fine for me in a script I made awhile back... Odd... notRezznov 35 — 9y
Ad

Answer this question