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

How do i make a script work for a button on a surface gui text button and not a block for lights?

This script is in a block with a "Click Detector" but when i move the script into a text button on a surface gui it wont work... And i cant move the click detector into the text button?

local Epic=script.Parent.ClickDetector function onClick() game.Workspace.Light1.PointLight.Color = Color3.new(255/255,0/255,0/255) game.Workspace.Light2.PointLight.Color = Color3.new(255/255,0/255,0/255) game.Workspace.Light3.PointLight.Color = Color3.new(255/255,0/255,0/255) game.Workspace.Light4.PointLight.Color = Color3.new(255/255,0/255,0/255) end Epic.MouseClick:connect(onClick)

I want that but i want the button to be a text button on surface gui not a block like it currently is.

2 answers

So would that be this in full

1Iscript.Parent.MouseButton1Click:connect(function()

2 I game.Workspace.Light1.PointLight.Color = Color3.new(255/255,0/255,0/255) 3 I game.Workspace.Light2.PointLight.Color = Color3.new(255/255,0/255,0/255) 4 I game.Workspace.Light3.PointLight.Color = Color3.new(255/255,0/255,0/255) 5 I game.Workspace.Light4.PointLight.Color = Color3.new(255/255,0/255,0/255) 6 I end)

And ty for helping

Next time, please put your code into Lua syntax. Also, in a TextButton, it would be

--remove "epic"

script.Parent.MouseButton1Click:connect(function()
--insert code here
end)

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