Hello! Welcome to skript.
You can do this by setting a variable to (defined as {variable}) to the time the player steps on the gold block (now) and then using a while loop until they hit a diamond block. I prefer not to spoonfeed code but I think that if I provide the code and then break it down, it'll be easier to understand and learn from.
Python:
on step on gold block:
set {_stopwatch} to now
{timed::%player's uuid%} is not set:
set {timed::%player's uuid%} to 0
else:
message "&cYou already started the parkour!" to player
while {timed::%player's uuid%} is set:
set {timed::%player's uuid%} to difference between now and {_stopwatch}
set line <number> of player's scoreboard to "%{timed::%player's uuid%}%"
wait 1 second
on step on diamond block:
message "&aFinal time: &c%{timed::%player's uuid%}%" to player
clear {timed::%player's uuid%}
Line 1: Simple detection of when they step on a gold block
Line 2: setting a local variable (has _ before the variable name and gets cleared when the event finishes, used to not take up space in your files)
Line 3: condition to check if the variable is set or not (if they have started the parkour or not)
Line 4: setting the variable that tells us if they are being timed and allows us to send the final time/scoreboard time. We use the player's uuid so that every player has a distinct variable, especially if more than one person is using the parkour at once.
Line 6: Message sent if they are already in the parkour
Line 7 (ignore the blank space, used to make it more readable): the while loop. This loop is designed to execute until we clear/delete the timed variable
Line 8: subtracting the old "now" (stored in the {_stopwatch} variable) from the new "now". This returns the time since we set the {_stopwatch} variable
Line 9: Setting the line of the player's scoreboard to the stopwatch value. Please change <number> to whatever line you want it to be. Line numbers are displayed in red to the right of the text. This line requires the SkBee addon for skript, which you can download
here, as base skript does not have direct support for changing the player's screen-side display.
Line 10: Detecting when they step on a diamond block
Line 11: Sending the player's final time in chat (only for them). If you don't want this to send in chat, change "message" to "send action bar"
Line 12: Deleting the timed variable, to stop the while loop and reset their time for the next run at the parkour.
The code is formatted in python for the colors that make it even more readable. It has been tested several times by myself.
By the way, the percentage signs (%) used in the variables and messages mean getting a value.
If you set {hello} to 6 and then did
message "{hello}" to player, it would just send "{hello}" but using percentage signs, like this
message "%{hello}%" to player will instead send "6". Similarly, {timed::%player's uuid%} doesnt register as
{timed::player's uuid}, it registers as {timed::ec4ee844-beb4-443b-bd17-cfaeb01bfa54} (that long string of characters changes depending on the player)
I apologize if this was confusing in any way or if I explained information you already knew.