Forest Logo
search
package_2

restime

By @borritomes

Roblox

Mirrored

Introduction

resTime is a library for keeping time loosely based by bevy's Time resource.

Installation

there is only one file so you can just copy and paste it or you can install with wally resTime = borritomes/restime@0.1.0

How to use

This is primarily meant as an easy way to keep a virtual time that can be sped up, slowed down or paused.
Time is created with resTime.new()

    local VirtualTime = resTime.new()
    local WallTime = resTime.new()

Time needs to be manually incremented with the Time:Tick() method

    RunService.stepped:connect(function()
        VirtualTime:Tick()
        WallTime:Tick()
    end)

You can get DeltaTime and ElapsedTime like this:

    --everything done with VirtualTime can be done with wall time the only difference is the name
    local deltaTime = VirtualTime:DeltaTime()
    local elapsedTime = VirtualTime:ElapsedTime()

A Time's timescale can be changed by editting Time.timescale

    --deltatime is multiplied by timescale internally
    VirtualTime.timescale = 2.0
    WallTime.timescale = 1.0 --walltime should usually stay at 1.0

Time can be freely paused and unpaused

    VirtualTime:Pause()
    VirtualTime:UnPause()

Package Details

Install command (Click to copy)


Version

0.1.4

License

MIT

check_circle

Safe for commercial use

infoLicense identified from the packaged LICENSE file; the manifest declared none.

Automated license review — not legal advice.