Calling Boolean Variable
Hello, I am trying to create an automated tween execution per object, Ive come up with an idea to use a loop statement to call tween so I could just copy and paste it.
so upon my testing the result is wrong, instead it prints "off!" (since the boolean is off) it prints "on".
maybe because the variable "obj" is string, is there a way to convert it from string to boolean?
or I am doing this in wrong way, please help me. thanks
try
Hi n-mikael, thank you for your reply but it does not work logically
I'm not entirely sure on your goals here and if this would suit, however my suggestion would be to take the bool values in as an array instead of one by one, i.e.
This way, if you just remove a tween from the array, logic for this tween won't even run
Thank you Jye for the response, that definitely will work but the scope of I wanted to achieve is this:
is there a way to call script.(name) using a string? ( for the first round of forloop script.Tween1 then next loop, script.Tween2 then last loop script.Tween3)
I just want to simplify my code using loop statement rather than typing everything one by one. in this way I can make my workflow hassle free.
Ah I think I see what you're trying to do. In Javascript there are two ways of calling/setting properties of an object.
In your case, instead of using:
within the loop, to get access to your tween variables, you can use:
Hope This helps!
Wow Jye, It works!! Thank you so much dude!!