You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want the text button to do something else after being clicked a second time
What is the issue? I’m not sure how to do something else when the text button is clicked a second time
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have tried loops and just a event and none of that worked
Hello so i’m making a on/off gui switch and i’m trying to do something else once the player clicked the text button again but i’m unsure how
this is what i tried so far
local Button = script.Parent
local Sky = game.Lighting.Sky
Button.MouseButton1Click:Connect(function(Clicked)
if Clicked then
Sky:Destroy()
-- disable the skybox
else
if Clicked then
Sky:Clone()
Sky.Parent = Sky
-- enable the sky box again
end
end
end)
local Button = script.Parent
local Sky = game.Lighting.Sky
local SkyEnabled = true
Button.MouseButton1Click:Connect(function()
SkyEnabled = not SkyEnabled
Sky.Parent = SkyEnabled and game.Lighting or nil
end)
local Button = script.Parent
local Sky = game.Lighting.Sky
local Clicks = 0
Button.MouseButton1Click:Connect(function(Clicked)
Clicks += 1
if Clicks == 1 then
Sky:Destroy()
-- disable the skybox
end
if Clicks == 2 then
Sky:Clone()
Sky.Parent = Sky
-- enable the sky box again
Clicks = 0
end
end)
I hope this works for you. Because it works for me.