Wait not working

This might be the silliest problem i may have encounters when coding, I am new to lua script and wait() is not working!


i was following a alvinblox video and he was making a little dice demonstration but when i run the code instead of one block falling then wait 2 second then the second block falling, both blocks fall at the same time

1 Like

You cannot leave a space before the parentheses

1 Like

maybe its because of the spaces? that shouldn’t matter tho…
@EnigmaticDevil has a good solution, nothing is wrong with your script, are you have been getting errors in the output?

are you sure the second block is anchored? or are both Dice even anchored?, cause you could be un-anchoring already un-anchored dices.

1 Like

Try increasing the wait() to wait(5) instead? And you should check if the Anchored property it set to true on both Dice parts as @EnigmaticDevil mentioned

1 Like

Use

wait()
--not
wait ()

Both dice are not anchored in the properties tab

cc. @IceTheOneAndOnly @FrazedGreatness2

In Luau, whitespaces are ignored during the tokenizer. wait (2) and wait(2) results in the same token.
https://www.lua.org/source/5.1/llex.c.html

        if (isspace(ls->current)) {
          lua_assert(!currIsNewline(ls));
          next(ls);
          continue;
        }
2 Likes

Java script lol I I am learning that

no errors in the output at all lol

You have to anchor them in the properties tab before you run it, if you want the desired effects.

1 Like

Thanks everyone for you’re help the code is working now :slight_smile: man you guys reply quick

Thank you for you’re help :slight_smile: