*turning car noises not work*

hola amigos,

I'm having an issue with car noises currently all my silly car noises are working great except the screech noise
Here is the local script where I’m having issues it is located inside starter character scripts

	connection = seat.Changed:connect(function(property)
		if property == "SteerFloat" then                           -- } this is where the issues are
			if property == "ThrottleFloat" then                   
				event:FireServer(soundTable,"screech",true)
				print("screech!")                                       --this is where the issues are
			else
				event:FireServer(soundTable,"screech",false)
			end                                                       --} 
			local rotation = Vector3.new(0, -seat.SteerFloat * seat.TurnSpeed, 90)
			tween:Create(AttachmentFl,Info,{Orientation = rotation}):Play()
			tween:Create(AttachmentFr,Info,{Orientation = rotation}):Play()
		elseif property == "ThrottleFloat" then
			local torque = math.abs(seat.ThrottleFloat) * seat.Torque * 20
			local velocity = -math.sign(seat.ThrottleFloat) * MaxSpeed 
			
			motorBl.Parent.Attachment.ParticleEmitter.Enabled = true
			motorBr.Parent.Attachment.ParticleEmitter.Enabled = true

			if torque == (0 or 2000) then 
				event:FireServer(soundTable, "drive", false)
				event:FireServer(soundTable, "idle", true)
				motorBl.Parent.Attachment.ParticleEmitter.Enabled =false
				motorBr.Parent.Attachment.ParticleEmitter.Enabled = false
				torque = 2000
			else
				event:FireServer(soundTable, "idle", false)
				event:FireServer(soundTable, "drive", true)
			end
			motorBl.MotorMaxTorque = torque
			motorBr.MotorMaxTorque = torque
			
			motorBl.AngularVelocity = velocity
			motorBr.AngularVelocity = velocity

here is the rest of the local script

--services
local runService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local tween = game:GetService("TweenService")
--paths
local event = script:WaitForChild("Sound")
local chr = script.Parent
-- variables
local Info = TweenInfo.new(.4, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local connection = nil
local thing = true
--events
chr.Humanoid.Seated:connect(function(active, seat)
	local thread = coroutine.create(function()
		local success, Error
		while runService.RenderStepped:Wait() and thing do
			print(active)
			workspace.CurrentCamera.CameraSubject = nil
			workspace.CurrentCamera.CameraType = Enum.CameraType.Fixed
			success, Error = pcall(function()
				game.Workspace.CurrentCamera.CFrame = seat.Parent.Part.CFrame
			end)
			if not success or not active or seat == nil then
				thing = false
				workspace.CurrentCamera.CameraSubject = chr.Humanoid
				workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
			end
		end	
		if not thing and success then
			thing = true
		end
	thing = true
	end)
	if thing then
		coroutine.resume(thread)
	end

	if not connection == nil then
		connection:Disconnect()
		connection = nil
	end
	
	
	
	if seat == nil then return end
	
	local soundTable = {}
	soundTable.screech = seat.Screech
	soundTable.idle = seat.idle
	soundTable.drive = seat.drive

	local AttachmentFl = seat.Parent.PrimaryPart.FL
	local AttachmentFr = seat.Parent.PrimaryPart.FR
	local motorBl = seat.Parent.WheelBL.CylindricalConstraint
	local motorBr = seat.Parent.WheelBR.CylindricalConstraint
	
	local MaxSpeed = seat.MaxSpeed/ (motorBl.Parent.Size.Y/2)
	
	connection = seat.Changed:connect(function(property)
		if property == "SteerFloat" then
			if property == "ThrottleFloat" then
				event:FireServer(soundTable,"screech",true)
				print("screech!")
			else
				event:FireServer(soundTable,"screech",false)
			end
			local rotation = Vector3.new(0, -seat.SteerFloat * seat.TurnSpeed, 90)
			tween:Create(AttachmentFl,Info,{Orientation = rotation}):Play()
			tween:Create(AttachmentFr,Info,{Orientation = rotation}):Play()
		elseif property == "ThrottleFloat" then
			local torque = math.abs(seat.ThrottleFloat) * seat.Torque * 20
			local velocity = -math.sign(seat.ThrottleFloat) * MaxSpeed 
			
			motorBl.Parent.Attachment.ParticleEmitter.Enabled = true
			motorBr.Parent.Attachment.ParticleEmitter.Enabled = true

			if torque == (0 or 2000) then 
				event:FireServer(soundTable, "drive", false)
				event:FireServer(soundTable, "idle", true)
				motorBl.Parent.Attachment.ParticleEmitter.Enabled =false
				motorBr.Parent.Attachment.ParticleEmitter.Enabled = false
				torque = 2000
			else
				event:FireServer(soundTable, "idle", false)
				event:FireServer(soundTable, "drive", true)
			end
			motorBl.MotorMaxTorque = torque
			motorBr.MotorMaxTorque = torque
			
			motorBl.AngularVelocity = velocity
			motorBr.AngularVelocity = velocity
		end
	end)
end)

Here is the server script where the sound plays

local SoundEvent = script.Parent.Sound

SoundEvent.OnServerEvent:Connect(function(plr, sound, name, play)
	if play then
		if not sound[name].IsPlaying and name == "screech" then
			sound[name].Playing = true
			warn("playin")
		else
			warn(name)
			sound[name]:play()
		end
		
	else
		sound[name]:Stop()
	end
	
end) -- sorry for the bad scripts :(

here is the workspace
Screenshot 2022-07-25 122800
Screenshot 2022-07-25 122914
and the output when driving
Screenshot 2022-07-25 123431

the top snip of the local script of the top and server script is really all you need to worry about every thing is working except the screech noise isnt playing

1 Like