Help with custom time module

Hi , So i’m making a custom time module (I know i’m reinventing the wheel but im doing for fun :stuck_out_tongue: ) So the problem i have is that because my Timer:Start() function uses a while loop to count it never finishes so the main script will never progress pass the the timer:Start() line

local Timer = {}
Timer.__index = Timer

	local NewTimer = {}
	NewTimer.Running = false
	NewTimer.Time = StartTime
	return NewTimer

function Timer:Start()
	self.Running = true
	while self.Running == true do
		self.Time = self.Time - 1

function Timer:Stop()
	self.Running = false

function Timer:Value()
	return self.Value
-- Main Script

TimerModule = require(game:GetService("ServerStorage").TimerModule)

local timer =



print("A") -- Never Does these lines?

I don’t believe you can do : in a module script, has to be all time.

So how would i do a timer then any advice? Thanks

Just change the : to . and it should work just fine.

Then i would have to changed the selfs then right? Hmm ill try it thanks

You never have a break or return in the while loop, it will run forever.

Well the While loop is depending on if a value is true, if the value turns false it should stop.

Changing : to . Did nothing , The Problem is roblox won’t run the lines under the function that starts the loop

So i cant use the :Stop Function under because it will never run these lines, I don’t necessarily want to fix my module i want another way of dealing with time if possible? Thanks

There’s nothing to tell it to be false.

You should try running Timer:Start() in a coroutine. That way, you can set self.Running to whatever value you want and it wont yield the thread.

If I were making a custom timer module, I would stay away from while loops in general and opt for a heartbeat-based wait instead. More precision and easier to stop imo.

Replied to wrong person sorry

Okay Thank You i’ll try it sounds good!