local textButton = script.Parent repeat wait(2) if script.parent.parent.AspectSelection.Text == '' then if script.parent.parent.ClassSelection.Text == '' then script.parent.Text = 'Please select a class and aspect' else script.parent.Text = 'Please select an aspect' end elseif script.parent.parent.ClassSelection.Text == '' then script.parent.Text = 'Please select a class' else script.parent.Text = '>Enter' textButton.Active = true end until 1 == 0 script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Enabled = false end)
I'm trying to make a button that stays inactive until you meet certain requirements (clicking two other buttons essentially). I've managed to get it to detect whether or not the requirements have been fulfilled, but i can't get it to actually reactivate the button.
Altered code based on NickAtNick's response
local textButton = script.Parent local bool = true repeat wait(2) if script.parent.parent.AspectSelection.Text == '' then if script.parent.parent.ClassSelection.Text == '' then script.parent.Text = 'Please select a class and aspect' script.Parent.Activated:Connect(function() bool = not bool -- toggle end) else script.parent.Text = 'Please select an aspect' script.Parent.Activated:Connect(function() bool = not bool -- toggle end) end elseif script.parent.parent.ClassSelection.Text == '' then script.parent.Text = 'Please select a class' script.Parent.Activated:Connect(function() bool = not bool -- toggle end) else script.Parent.Activated:Connect(function() bool = bool -- toggle end) script.parent.Text = '>Enter' end until 1 == 0 script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Enabled = false end) script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Enabled = false end)
With a boolean variable local bool = true
, true is when the button is activated and set the boolean variable to false to deactivate the textbutton!
First , store a boolean variable with the var. Name of your choice then set it to true
local textButton = script.Parent local bool = true -- it can be false...
Next, just "invert" the value with the not
logical operator:
script.Parent.Activated:Connect(function() bool = not bool -- toggle -- other stuff end)