Datastore issue | live updates or intervals

hey im trying to do something with datastores that require live updates or some sort of interval, what would be the best way to implement this which is optimised and efficient?

ive tried doing a while wait loop but i feel like there is a method that is better

Unless the goal is very specific, there really should not be a need to update datastores frequently or at intervals as you suggest. You can use the PlayerRemoved event and update the datastore then, or on BindToClose when the server shuts down.

i mean its a complicated thing to explain but would doing a while wait(10) loop be ok? would i have to do more time? less time?

If there is a lot of centralized lag that causes players to disconnect from your servers or if there is a lot of use of the teleport service then I see why this would be needed. Otherwise, I think it is best to just load data when you join and save it when you leave. But to answer your question, I would lean more toward one minute intervals

I don’t recommend updating on an interval unless it is really required to do so. Roblox is planning on adding a fast DataStore service that holds temporary data but has crazy read and write speeds. What exactly do you need the interval update for? If you can, work around it, otherwise, utilize the DataStore limits and give some leniency to then so you have spare requests in case you need them.