There is no better solution than that. If you want to have a loop, this is the best way to have a loop.
Heartbeat, Stepped, and other events are useful but they are not meant to be used in places where a simple loop does the job.
(I would recommend doing while true do task.wait() instead of what you mentioned in the title, as it is a good practice.)