so im trying to make this car, but im a modeler, with no scripting capability
but i need to make script like jailbreak, cause jailbreak has a car revving sound so when you drive it actually makes noises, but im trying to figure out how to make something like that so please help!!
well i have it functioning and the chasis made from scratch already, i just need to know how to add velocity sounds and sounds like the jailbreak cars does
EngineSound:Play()
function MainCarFunction()
EngineSound.PlaybackSpeed = RPM
end
Firstly, you would need to put a sound object in your car somewhere and put a cool engine noise for the SoundID. This is what I use sometimes: “rbxassetid://311787905”.
Next, I don’t know whether you are using a constant speed or simulated RPM in your car, but you can do EngineSound.PlaybackSpeed = RPM, or EngineSound.PlaybackSpeed = VehicleSpeed. Either of these options will create the revving sound, although using RPM would sound much better.
We are basically making the PlaybackSpeed of the audio equal to an RPM value or a VehicleSpeed value in order to simulate a revving sound.
Yes this would work, although you need to make sure to use a value for RPM rather than Text. The goal of this is to equate a number value to PlaybackSpeed. Sorry for the super late reply as I have been inactive recently. If you haven’t already figured it out, I hope this helps!
Alright. So. Assuming you are a modeler and not a scripter, I wouldn’t recommend trying to make the cars from jailbreak, as those use complex math and you’ll need to be a decent scripter to be able to make those.
If I were you, I would start with this:
Now, if you really want to know how the cars from jailbreak work, there are already plenty of topics including one I will show you right now:
Now once you have 4 thrusters on your chassis, the equation I would recommend using would be:
local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.SuspensionHeight.Value)
local thrusterHeight = (position - thruster.Position).magnitude
if hit and hit.CanCollide then
local len = SuspensionHeight.Value - (position-thruster.Position).Magnitude
local f = -SuspensionHeight*damping*thruster.Velocity:Dot(-thruster.CFrame.UpVector)
vectorForce.Force = Vector3.new(0, -f, 0)
else
vectorForce.Force = Vector3.new(0, 0, 0)
end
You could use the suspension code from the roblox jeep, but it doesn’t work well at high framerates.
Then the way you would do traction is by taking the sideways velocity of the vehicle car.Chassis.Velocity:Dot(car.Chassis.CFrame.RightVector) then you would apply a force to the vehicle in the opposite direction, and your force would be something like this: -car.Chassis.Velocity:Dot(car.Chassis.CFrame.RightVector) * mass * someConstant * dt
Lastly, when making the vehicle move forward or backward, I would recommend using a VectorForce, or BodyThrust as using velocity to move the vehicle is very unrealistic, and there are some issues with using velocity to move the vehicle instead of a force.