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

Repeat Wait() until , How to add if statements?

Asked by 9 years ago
Main.Left.DescendantAdded:connect(function(obj)
    if obj:IsA("BoolValue") then  return end
     print 'operating' repeat wait() until obj.Position.Y.Scale <= -0.1 
    if obj.Pass == false then Bad()  Lv=Lv+1  print'Bad' return end ---- Not Firing
    obj:remove()  
    print 'works'

     end)

Basically what I intended to occur was when that position is acquired only then would the script check the if statements. But for some reason it is not firing.

Main.Left is a Frame Pass is as BoolValue Lv is a variable

0
Thank you so much. I never realized this property of those values. I wish the wiki was more dense and explained the specifics of everything rather than just telling me what it does. SamDomino 65 — 9y

2 answers

Log in to vote
1
Answered by
Marios2 360 Moderation Voter
9 years ago

Although the title of the question is very confusing, i believe to have found the issue.

What eLunate meant to say is that, to refer to the stored value of an instance which does so (Any instance that ends with "Value", ex. BoolValue, StringValue, IntValue), you use Object.Value, supposing Object is any object that stores a value.

That is because Value is one of the many properties of the instance, and the instance itself cannot be a stored value, only one of it's properties. So you refer to the property like any other. In addition, eLunate meant that obj.Pass is always true, because in this case it checks if the item exists instead of checking the Value property of the item, which you intended to do.

Your fixed script:

Main.Left.DescendantAdded:connect(function(obj)
    if obj:IsA("BoolValue") then return end
    print 'operating'
    repeat wait() until obj.Position.Y.Scale <= -0.1 
    if obj.Pass.Value == false then Bad()  Lv=Lv+1  print'Bad' return end --Refer to the property, not the object
    obj:remove()
    print 'works'
end)
Ad
Log in to vote
0
Answered by 9 years ago

I'm fairly sure that Pass is not a property of GuiObject and therefore can't be false.

Answer this question