I want to make it so that as the speed of a car increases, the pitch of a sound that is in the vehicle seat also increases. Here is the current function that I have:
local maxSpeed = filtered local minPitch = filtered local maxPitch = filtered local pInc = (maxPitch / maxSpeed)
local function setPitch(speed) local currPitch = (speed * pInc) currPitch = math.clamp(currPitch, minPitch, maxPitch) sound.PlaybackSpeed = currentPitch end
What do I need to do to make it work? I have it in my vehicle seat with a sound that is not playing. Please help, I have been looking for months.

3 comments
Pitch is deprecated, but you can achieve a similar effect by inserting a PitchShiftSoundEffect into the Sound Object
but
The point is to make it so as you accelerate the sound playing in the vehicle seat gets a higher pitch, or in this case now, higher playback speed. So speed is linear to playback speed basically is what I want, similar to the cars in jailbreak or prison life.