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

Button Panel: No Output, No Effect?

I don't know anything about scripting, but i know enough to try and make a button panel that simply switches two lights, one red, one green, on and off, with some other information gathering for later use.

I've built the panel, the lights, and the button. Here is the code.

local Green = game.workspace.Console.lights.Green
local Red = game.workspace.Console.lights.Red

function Star()
	if Green.BrickColor.Name == "Earth Green"
		then
		script.parent.parent.parent.lights.Green.BrickColor = BrickColor.new(0,1,0)
		script.parent.parent.parent.lights.Red.BrickColor = BrickColor.new(0.8,0.3,0.3)
		script.parent.parent.parent.lights.Red.Material = "SmoothPlastic"
		script.button.Position = "4.1, 3.533, -3.966"
	end
	if Green.BrickColor.Name == "Lime Green"
		then
		script.parent.parent.parent.lights.Green.BrickColor = BrickColor.new(0.4,0.7,0.4)
		script.parent.parent.parent.lights.Red.BrickColor = BrickColor.new(1,0,0)
		script.parent.parent.parent.lights.Red.Material = "SmoothPlastic"
		script.button.Position = "4.1, 3.56, -3.953"	
	end
end
script.Parent.ClickDetector.MouseClick:connect(Star)

For some reason, pressing the button no longer gives me any output. I have no information on what exactly is wrong here, so any assistance would be cool. thanks.

2 answers

That last line could be the reason, at least I think so.

Old:

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

New:

script.Parent.ClickDetector.MouseClick:Connect(function()
	Star()
end)

Let me know if that helped!

1 comment

0

no, you can just put the function driectly. The C was lowecase maybe that's the preblem

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