First of all say if you want to check one-two times the speed via a command or create a speedometer?
A sample GetPlayerSpeed() can be done by creating a new function that:
1. Saves your pos now.
2. Waits a while e.g. 500 ms.
3. Takes the saved pos and the pos now.
4. Some math (X1 - X2 and probably ^2).
5. Return the speed. However if you would like to see the speed in kmh, you will need maybe everything x4.
Maybe this can be helpful
.