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

I made 2 buttons that would turn on and off the generators but for some reason they don't. Why?

Asked by 7 years ago
Edited 7 years ago

I was trying to make 2 buttons which would turn on or off the generators.

But if you know LUA and isn't a beginner, You can see that I pretty much screwed up.


function onClicked(playerWhoClicked) game.Lighting.Ambiet = [0,0,0] end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

There wasn't anything in the Output related to this.

0
Can you put your code in a code block. User#5423 17 — 7y
0
Use a code block SH_Helper 61 — 7y

1 answer

Log in to vote
0
Answered by
lyxture 27
7 years ago
Edited 7 years ago

i think this is what you want make a model with 2 parts in them name 1 of them OnPart and the other 1 OffPart and within those parts put a clickdetector in them and also put a script in the model Putting everything up and what you want to write in the code is this

script.Parent.OnPart.ClickDetector.mouseClick:connect(function()
    game.Lighting.Ambient = Color3.new(255/255,255/255,255/255)
end)
script.Parent.OffPart.ClickDetector.mouseClick:connect(function()
    game.Lighting.Ambient = Color3.new(-255/255,-255/255,-255/255)
end)

if you did everything i said correctly then you would get this as your result Result

0
Instead of dividing everything by 255, use Color3.fromRGB. GoldenPhysics 474 — 7y
Ad

Answer this question