If I want to straight up loop a tween can I get a way with setting the RepeatCount in TweenInfo to math.huge - or is that dumber than I realise?
Cheers
If I want to straight up loop a tween can I get a way with setting the RepeatCount in TweenInfo to math.huge - or is that dumber than I realise?
Cheers
I set RepeatCount to 1e309 a few times, and it worked as expected.
It should be fine to put a huge number there. I do this myself and haven’t run into issues yet.
EDIT: see zeuxcg’s reply below, -1 is neater.
Setting repeat count to -1 also works in my experience. Seems to repeat forever.
I think it works because they set the base number to 0 and then increment it until it reaches the other number(while num ~= yournum do). So yeah
Warning: This is not safe! Use RepeatCount = -1 instead!
RepeatCount is an integer; when you assign a Lua number value to an integer, you are relying on double->int casting rules that are not specified in C++. There are three possible options:
RepeatCount is an integer, and negative values mean “repeat forever”. So in this specific case both actually observed behaviors are doing the same thing (on desktop you get a negative value and it repeats forever; on mobile you get 2^31 so it repeats essentially forever, although a 100ms tween with 2^31 repeat count will stop repeating in ~7 years), but you can not rely on it - one day we may port Roblox to an architecture that does something else and your code will break. Just use RepeatCount = -1.
(note: wiki currently doesn’t mention this but I’m told by @darthskrill that negative repeat counts are a feature so it should be safe to rely on; cc @UristMcSparks)
Oh yeah that explanation is better.
Great info, thank you.