I’m currently making a settings gui with a toggleable button. The issue here is that the buttons keep acting weird and won’t become visible when pressed.
Code:
local function onSlider1Activated()
Slider1.Active = true
Slider2.Visible = false
end
Slider1.Activated:Connect(onSlider1Activated)
local function onSlider2Activated()
Slider1.Active = false
Slider2.Visible = true
end
Slider1.Activated:Connect(onSlider2Activated)
Here is what I’m trying to achieve in simpler terms…
You’re setting the Active property, which doesn’t turn the Gui element on or off. Instead, do:
local function onSlider1Activated()
Slider1.Visible = true --changed here: active to visible
Slider2.Visible = false
end
Slider1.Activated:Connect(onSlider1Activated)
local function onSlider2Activated()
Slider1.Visible = false --changed here: active to visible
Slider2.Visible = true
end
Slider1.Activated:Connect(onSlider2Activated)
local function onSliderActivated()
Slider1.Visible = not Slider1.Visible
Slider2.Visible = not Slider2.Visible
end
Slider1.Activated:Connect(onSliderActivated)
Slider1.Activated:Connect(onSliderActivated)
local function onSlider1Activated()
Slider1.Visible = true
Slider2.Visible = false
end
Slider1.Activated:Connect(onSlider1Activated)
local function onSlider2Activated()
Slider1.Visible = false
Slider2.Visible = true
end
Slider2.Activated:Connect(onSlider2Activated)
I did it like this, but Slider 2 doesn’t become enabled and Slider 1 doesn’t become disabled either when the ImageButton is pressed.
local function onSlider1Activated()
Slider1.Visible = true
Slider2.Visible = false
end
Slider1.MouseButton1Click:Connect(onSlider1Activated)
local function onSlider2Activated()
Slider1.Visible = false
Slider2.Visible = true
end
Slider1.MouseButton1Click:Connect(onSlider2Activated)
Sorry in advance if I’m not understanding the issue correctly.
Also would there be a way to make it so something happens when the Slider2 becomes visible, then something else happens when it is not visible anymore?
local function onSliderActivated()
game.SoundService.Sound.Playing = false
print("Disabled")
Slider1.Visible = not Slider1.Visible
print("Enabled")
game.SoundService.Sound.Playing = true
Slider2.Visible = not Slider2.Visible
end
Slider1.Activated:Connect(onSliderActivated)
Slider2.Activated:Connect(onSliderActivated)
local function onSliderActivated()
game.SoundService.Sound.Playing = not game.SoundService.Sound.Playing
Slider1.Visible = not Slider1.Visible
Slider2.Visible = not Slider2.Visible
end
Slider1.Activated:Connect(onSliderActivated)
Slider2.Activated:Connect(onSliderActivated)
local slideractive = false
local function onSliderActivated()
Slider1.Visible = not Slider1.Visible
Slider2.Visible = not Slider2.Visible
if slideractive then
slideractive = false
game.SoundService.Sound.Playing = false
else
slideractive = true
game.SoundService.Sound.Playing = true
end
end
Slider1.Activated:Connect(onSliderActivated)
Slider2.Activated:Connect(onSliderActivated)