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

How do I make a function yield if its requirements hasn't been met ?

What I am trying to do here is if Baseplates transparency is over then I will print its gone

function WaitForSomething()
	if game.Workspace.Baseplate.Transparency > .5 then
		
	end
	
	
end


if WaitForSomething() then

print('Gone')

end

1 answer

✓ Accepted answer

You could use :GetPropertyChangedSignal which would fire when what ever you put between the Speech Marks has changed.

For example below i have placed "Transparency" between the speech marks which makes the script wait for the Transparency of the Base plate to change then Fires the WaitForSomething Function

But you have to make sure that it is a Property.

function WaitForSomething()
if game.Workspace.Baseplate.Transparency > .5 then
    print("Gone")
    end
end

workspace.Baseplate:GetPropertyChangedSignal("Transparency"):Connect(WaitForSomething)

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