I want to play a sound on a vehicle at a certain velocity and with a hinge at a certain angularvelocity but the = causes an error

I want to make a reverse sound play when you are past a certain velocity and a constraint at a certain angular velocity but using = breaks the whole script.
Train = script.Parent.Train Train.Value = script.Parent.Parent function ThrottleHandle() if Train.Value.DriveSeat.Throttle == 1 and Train.Value.DriveSeat.Velocity.Magnitude > 10 and script.Parent.Parent.Arm.A1.HingeConstraint.AngularVelocity = -5 then script.Parent.Parent.Body1.TAILGATE.Main.Reverse:Play() script.Parent.Parent.Body1.TAILGATE.Main.Reverse1:Play()

elseif Train.Value.DriveSeat.Throttle == 0 then



	
elseif Train.Value.DriveSeat.Throttle == -1 and Train.Value.DriveSeat.Velocity.Magnitude < 10 then
	script.Parent.Parent.Body1.TAILGATE.Main.Reverse:Stop()
	script.Parent.Parent.Body1.TAILGATE.Main.Reverse1:Stop()

	
	---

	
	
end	

end

Train.Value.DriveSeat.Changed:connect(ThrottleHandle)
Here’s a picture of the error message.


Please reply if you have a solution.

1 Like

Put another equals. Conditional checks require two equals, one is just an assignment.
https://www.lua.org/pil/3.2.html

the β€œ=” should be β€œ==” because it is in a if then statement.

2 Likes