Introducing SmartShutdown!

you should make this an open source project on github so viewing the code can be easier and you will be able to allow other people to recommend changes.

Okay! I will do that when I’ll have time. (Hopefully right now)

The fact that using loops to animate something is terrible! It’s tweening not tweeting…

Sorry, I was typing on my ipad, autocorrect.

How so? Change it if you want. It’s a linear fade-in effect, nothing special. I don’t see any advantages with tweening in this case.

I think I’ll just put the code here, It won’t matter anyhow.

It’s good in theory but something like this exists already and you’re using outdated/bad scripting practices such as using loops instead of tweening and not checking if children of the object exist before changing parameters which in some cases (like with high ping or slow computers) can cause nil pointer errors.

Using spawn is not recommended either unless you’re using it solely because you need to wait before starting a loop/tween/etc.

The problem with using loops for effects is that it’s very limited, unstable (framerate dependent), and hard to time correctly as opposed to a tween where you can just pass in the duration in seconds.

Tweening is frame dependent too. However, as everyone wants me to change it to tweeting, I’ll do it!

They’re both frame-dependent, but I remember reading that it tries to compensate for any fluctuations in frame rate using the deltatime between frames. This doesn’t remove the issue but compared to using a standard loop the difference can be noticeable in extreme cases.

For small effects like a simple transparency change this isn’t a huge issue but it’s generally good practice to use Tweens regardless of the effect.

If you don’t want to use loops and still sorta go the route you went, you could instead bind to RenderStepped and calculate the relative transparency change based on the deltatime passed along, basically a very primitive tween.

Okay, good to know! I just fixed all the issues you talked about! Realising the version.

That will take a bit more time to script, and there’s no point in such, as I am using tweening.

Check out the new update, I fixed it.

1 Like

eventhough this post is pretty cool i want to point out the fact that some examples in your post are a bit contradictory, disregarding the fact that people have told you countless times to use tweenservice when fading anything and otherwise its a bad practice, you have two bits of code that use two different ways of doing the same thing.

namely in this bit you decide to opt for tweenservice but in doing the exact same thing when trying to teach new programmers how to add effects

you decide to opt for a spawn() and for loop

i believe having two different ways to create the same effect (again disregarding that using spawn() and for loops for effects are a horrible practice to teach to new programmers) would create confusion if i was relatively inexperienced and trying to achieve these effects.

i think you should probably edit these bits so you only use one method, most preferably tweenservice since it’s better to use in the long run.

Yeah, sorry. Forgot to change the documentation.

Thanks alex, this will be useful for our games. Note: for everyone that was complaining about using spawn instead of tweening… it’s for new programmers/non-programmers who want to just paste it in xd. You can always use deltatime to make it constant. But yes, tweening is usually better.

1 Like