Hello, I am trying to create a script for a racing game I’m working on where there are three “Sections” and I want to create a ScreenGUI that displays how long it’s been since you hit the last checkpoint/section.
But I am unfortunately clueless and have no idea how to do something like this. I have created this image in an attempt to demonstrate what I am trying to achieve.
I’ve spent a while looking for anybody with a remotely similar problem on the DevForum and other websites but could find none.
local last_touched = 0 -- the time (in seconds) the part was last touched
local stored_time = os.clock() -- the time (in seconds) that had passed since the UNIX Epoch at the time of the variable's declaration
local part_to_touch = <BasePart> -- the part to be touched
last_touched = os.clock() - stored_time
-- this subtracts the current time from the original stored time
-- this could look like: 107.5 - 95
-- the current time is the amount of seconds since the UNIX Epoch (Jan 1, 1970)
This only returns the amount of seconds however, you’d have to use string manipulation for minutes, hours, etc.