How do I check if a word was printed in the last 5 seconds

How do I check if a word was printed in the last 5 seconds

local LogService = game:GetService("LogService")

local LastPrint = 0
LogService.MessageOut:Connect(function(Message)
    LastPrint = tick()
end)

wait(4)

local Now = tick()

if (Now - LastPrint) <= 5 then
     print"something was outputted in the last 5 seconds"
end
1 Like

Ok thank you where do I put this?

i suppose u should put this inside a server script

1 Like

If your printing on the server you would put it in ServerScriptService as a normal script, if your doing it on the client you would put it in StarterPlayerScripts as a LocalScript.

1 Like