How to remove a tag with os.Clock?

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to remove a tag after 15 seconds player got it

  2. What is the issue? Include screenshots / videos if possible!
    I read a few documents and past posts but still didn’t understand why it is not working. this maybe not considered as a issue or ıdk

  3. What solutions have you tried so far Did you look for solutions on the Developer Hub?
    Using task.wait() works fine and removes the tag so I guess I am kinda stupid to not make it work with os.clock but while using os.clock it removes the tag without waiting any seconds

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here is the code I tried

Humanoid.Died:Connect(function()
			
			if not CollectionService:HasTag(player,"Tag") then
				CollectionService:AddTag(player,"Tag")
				local FirstTime= os.clock()
				local TimeLimit = 15
		          print(os.clock())
				if os.clock()>=FirstTime then
					print("TEst1") -- it does print 
						FirstTime = os.clock() + TimeLimit
					CollectionService:RemoveTag(player,"Tag")
					end
			end

Os.clock only measures cpu time when the function is called.

It does not do work with the task scheduler to delay the task and run the code at later time, so you will still need to use something else with os.clock to constantly check the time like a loop or runservice heartbeat.

Task.wait() will be better in this scenario. Os.clock should be used for discrete events like skill cooldowns and such where the event is triggered with a mouse button press.

I Thought I could use os.clock or os.Time because they are quite usefull for cooldowns! thanks!