Secure the RemoteEvents

Hello guys! I’m creating a score system based on the time remaining. My system calculates the score as

local Result = 60*min+sec

But the problem is that I do calculations on the client side of the game and must send these calculations to the server since I do this in a timer script. The question is how to make sure that an attacker cannot send whatever he wants to the server?

You can calculate it by

local t1 = os.clock() --gives the time in seconds (with the float point)
local diff = os.clock()-t1

and you can try to make it on the server side for each player

Will this be correct from the point of view of server optimization?

Yes, it will take less time than sending it through an event. Example:

local start = os.clock()
local times = {}
for i, player in pairs(players) do
    if not times[i] then times[i] = start
    if (something happened) then
        times[i] = 0
    else
        times[i] = os.clock()
    end
    if times[i] > 0 then --add score
    end
    task.wait()
end

This will probably be better