Try changing your code to the one below. Basically, It’ll set the Enabled property to the opposite of it. (if false, then true, elseif false, then true)
local button = script.Parent
script.Parent.MouseButton1Click:Connect(function()
button.Parent.Parent.Spiral.Enabled = not button.Parent.Parent.Spiral.Enabled
button.Parent.Parent.Swimmingpool.Enabled = not button.Parent.Parent.Swimmingpool.Enabled
button.Parent.Parent.Building.Enabled = not button.Parent.Parent.Building.Enabled
button.Parent.Parent.Trails.Enabled = not button.Parent.Parent.Trails.Enabled
button.Parent.Parent.stairs.Enabled = not button.Parent.Parent.stairs.Enabled
end)
You should loop through the buttons parent and disable and enable it if its name is in the table example:
local button = script.Parent
local Names = {'Spiral','Swimmingpool','Building','Trails','stairs'}
button.MouseButton1Click:Connect(function()
for _,Object in ipairs(button.Parent.Parent:GetChildren()) do
if table.find(Names,Object.Name) then
Object.Enabled = not Object.Enabled
end
end
end)