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

Help with BoolValue?

Asked by 8 years ago

I have a script that if I click the part, it should make it's child, 'Curve' to true but it's not. I put a test if it works by putting 'print ('change')' and it works but 'Curve' isn't changing to true. Please help.

cur = script.Curve.Value
part = script.Parent
clickDetector = Instance.new("ClickDetector", part)

function onMouseClick(player)
    print('change')
    if not cur == true then
  cur = true
    elseif cur == true then
        cur = false
    end
end
clickDetector.MouseClick:connect(onMouseClick)

1 answer

Log in to vote
0
Answered by 8 years ago
cur = script.Curve
part = script.Parent
clickDetector = Instance.new("ClickDetector", part)

function onMouseClick(player)
    print('change')
    if not cur.Value == true then
  cur.Value = true
    elseif cur.Value == true then
        cur.Value = false
    end
end
clickDetector.MouseClick:connect(onMouseClick)

You see, if cur were to = the value, then the value would be false/true, so your code would be doing this, if false = true then false = true elseif true = false then true = false. Understand?

Ad

Answer this question