Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What have i done wrong?

--iiTiago <33333
IsOn = script.Parent.IsOn
IsOn = true
Black = script.Parent.Parent.Black
Red = script.Parent.Parent.Red
Close = script.Parent.Parent.Close
Show = script.Parent.Parent.Show
Black2 = script.Parent.Parent.Black2

function IsOn()
	if IsOn == true then
		print("Test")
		Black.Visible = false
		Red.Visible = false
		Close.Visible = false
		Show.Visible = true
		Black2.Visible = true
		IsOn = false
		print("ily")
	end
end

print("umg")

function IsOff()
	if IsOn == false then
		Black.Visible = true
		Red.Visible = true
		Close.Visible = true
		Show.Visible = false
		Black2.Visible = false	
		IsOn = true	
	end
end

Close.MouseButton1Click:connect(IsOn)
Show.MouseButton1Click:connect(IsOff)

My script isnt working how would i fix it? The script is meant to close when a button is clicked and open when a button is clicked. Surprisingly there is no errors in the output.

1 comment

0

It would help us if you provided an error if one is present. What is this supposed to do? What is it doing instead? There is a lot of information missing.

1 answer

✓ Accepted answer

Your problem is you are trying to change the value of IsOn, but you are actually requesting to change IsOn, but not the value, to true or false.

--iiTiago <33333
IsOn = script.Parent.IsOn
IsOn.Value = true
Black = script.Parent.Parent.Black
Red = script.Parent.Parent.Red
Close = script.Parent.Parent.Close
Show = script.Parent.Parent.Show
Black2 = script.Parent.Parent.Black2

function On() --try coohing a diferent name for the function to avoid bugs
	if IsOn.Value == true then --you need to put .Value after all of the IsOns
    print("Test")
    Black.Visible = false
    Red.Visible = false
    Close.Visible = false
    Show.Visible = true
    Black2.Visible = true
    IsOn.Value = false
    print("ily")
	end
end

print("umg")

function IsOff()
if IsOn.Value == false then
    Black.Visible = true
    Red.Visible = true
    Close.Visible = true
    Show.Visible = false
    Black2.Visible = false  
    IsOn.Value = true 
	end
end

Close.MouseButton1Click:connect(On)
Show.MouseButton1Click:connect(IsOff)

This discussion is preserved as it was. New answers, comments, and votes are closed.