Toggle a value with a text button

  1. I want to toggle a value when I press a button

  2. Will enable but not disable.
    For reference, there are four securityalarms

local Toggled = true


	script.Parent.MouseButton1Click:connect(function(GetCar)
	if Toggled == true then
		Toggled = false
	for i,v in pairs(game.Workspace:GetChildren()) do
		if v.Name == "SecurityAlarm" then
			v.AlarmActive.Disabled = false
			
			
	elseif Toggled == false then
		Toggled = true			for i,v in pairs(game.Workspace:GetChildren()) do
					if v.Name == "SecurityAlarm" then
						v.AlarmActive.Disabled = true
						v.AlarmDisable.Disabled = false
						
			end
			end
			
		end
		end
		end
end)

Sorry but I don’t understand the problem. Please give me better explanations.

you quite literally enable it right after disabling it lol.

1 Like