workspace.CodeRedButton.ClickDetector.MouseClick:Connect(function)
script.Parent.ClickDetector:Destroy()
	script.Parent.SurfaceGui.TextLabel.Text = "Please Wait"
	wait(70)
	Instance.new("ClickDetector")
	ClickDetector.Parent = script.Parent
end

This is the function that isn't working in my script. I am making it so it removes the click detector then replaces a new one after 70 seconds to ensure they can't click the button yet but it isn't working. The error code says: Workspace.DisableCodeRed.Main:1: Expected '(' when parsing function, got ')'

FULL SCRIPT:

workspace.CodeRedButton.ClickDetector.MouseClick:Connect(function)
script.Parent.ClickDetector:Destroy()
	script.Parent.SurfaceGui.TextLabel.Text = "Please Wait"
	wait(70)
	Instance.new("ClickDetector")
	ClickDetector.Parent = script.Parent
end

script.Parent.ClickDetector.MouseClick:Connect(function()
	        for i,v in pairs(workspace.Lights.Lights:GetChildren()) do
            if v:IsA("Part") then
                v.BrickColor = BrickColor.new("White")
            end
        end
		workspace.CodeRed:Stop()
		workspace.Ambience.Sound3:Stop()
		workspace.Breach:Stop()
		wait(3)
end)

1 comment

0

I made an edit to mine. Does it work?