Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What have i done wrong?

Asked by
iiTiago 15
9 years ago
--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.

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. Necrorave 560 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)
Ad

Answer this question