Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How should I go about making a speed detecting system?

Alright, so I develop for a group and the owner keeps pushing me to make a speed radar for his police vehicles, my problem is I have no idea how to go about it...

I've had a few ideas like making the vehicles store a speed value in their car as it changes, but I can't change the coding of any of the civillian vehicles, so that won't work.

I have wondered if there is a way to pull a player's speed, but I have no clue about that.

Any and all suggestions or ideas about what to do for this will be a huge help to me... Anything will help related to this issue.

3 comments

0

Velocity is distance/time. Just calculate how much distance the car goes in x amount of time.

0

As Phlegethon said, use the formula for velocity. I generally just run a spawn function which holds an old point (p1) and a new point (p2), and check their magnitude. Then divide the magnitude by the spawn function's interval rate.

2 answers

✓ Accepted answer

All objects affected by physics will have their Velocity property change depending on the moving direction and speed of the object. The length of the vector is the object's speed: object.Velocity.Magnitude (studs/s).

1 comment

0

Alright, so I'm trying to use raycasting to find a part, any idea how I can get it to return what the part was?

The speed detector set up

Part A:

Part B:

A loop that increments each second

Distance is pre-calculated when you place the distance between part A and B which is divided by the time and displayed on the detector as a surface gui.

This discussion is preserved as it was. New answers, comments, and votes are closed.