Speed Not Detecting (VehicleSeat)

  1. What do you want to achieve? Keep it simple and clear!
    On VehicleSeat Going Fast, Print A Statement.

  2. What is the issue? Include screenshots / videos if possible!
    Wont detect the car is moving fast, and is only printing “not fast”

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Devfourms and videos

Code:

local hitPart = script.Parent
local vehicleSeat = script.Parent.Parent.VehicleSeat

local speed = vehicleSeat.CFrame.LookVector:Dot(vehicleSeat.Velocity)

while true do
	task.wait(0.5)
	if speed >= 15 then
		warn("going fast")
	else
		warn("not fast")
	end
end

Explorer:
image

Video:

PS: The max speed of the car is 35

I believe in your case speed is just a number variable. When you call
speed = vehicleSeat.CFrame.LookVector:Dot(vehicleSeat.Velocity) it sets your variable speed to the vector dot product at the time of you calling it, so if this script runs as soon as the game starts speed would be 0.

Instead try changing if speed >= 15 then to
if vehicleSeat.CFrame.LookVector:Dot(vehicleSeat.Velocity) >= 15 and see if that works

Hey there, it totally works now and the prints are well printing. Thanks alot!

Video:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.