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

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

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

1 comment

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.

2 answers

✓ Accepted answer

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)

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

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