Am I using tick correctly?

Doing a few checks on the server.

Am I thinking this is going to do what I want it too right? I have not touched tick really so I don’t exactly understand it however I understand people do some math like: tick() - x > y


Code:


if engineNitro ~= 0 and NitroEnabled == true and tick() - NitroTime > 1 then
				continue
			else
				if speed > MaxSpeed and speed == NitroMaxSpeed then
					
					if speed == NitroMaxSpeed or speed == NitroMaxAccel then
							
						player:Kick("exploit test")
						
						local co = coroutine.running()
						
						if engine.Parent ~= nil then
							
							engine:SetAttribute("_speed", 0)
							engine.Parent:Destroy()
						else
							print("destroyed cheater car")
						end
						
						if co ~= nil then

							coroutine.yield(co)
							coroutine.close(co)

						end
						
					end
						
				end
			end

1 Like

Without information of what NitroTime is, there’s no way we can really tell you. Though, remember that what tick() returns is:

Returns how much time has elapsed, in seconds, since the UNIX epoch, on the current local session’s computer. The UNIX epoch is represented by the date January 1st, 1970.

In other words, the math you’re referring to (tick() - x > y) calculates how much time in seconds has passed since x time. Think of it as if tick() returned 1001, but x (an already registered time, could be when an ability was last used in order to check its cooldown) is 1201, i.e., tick() - x equals to 200 (200 seconds have passed between x (old registered time) and tick() (current time)).

I would like the reply but hit my Max so thanks.