I made button where you press brick and then it shows surface box, but when you click it again it doesn't show it anymore. Here's my script:
local isOn = false
function onClicked()
isOn = true
script.Parent.SelectionBox.Visible = true
script.Parent.SelectionBox.Color3 = Color3.new(255,0,0)
end
function offClicked()
isOn = false
script.Parent.SelectionBox.Visible = false
script.Parent.SelectionBox.Color3 = Color3.new(0,0,0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
offClicked()
For some reason, when I click it, it shows everything I need but when I click it again, it doesn't turn off like I want it too. Why?
