So basically I'm making an A-Chassis 6.81T car and I wanted to put in an ignition script. The ignition script itself works, but when the car is off, I can still hear the engine running. I've tried looking at the "AC6_Stock_Sound" script but I don't understand a thing. I've tried doing putting this line of code into the ignition script but it didn't work.
script.Parent.AC6_Stock_Sound.Rev:Stop()
This is what the ignition script looks like by the way.
--Startup / Stop programming
function onKeyPress(inputObject, gameProcessedEvent)--\/ edit that, its the ignition key
if inputObject.KeyCode == Enum.KeyCode.J then
if script.Parent.IsOn.Value == false then
script.Parent.IsOn.Value = true
script.Sound:Play()
script.Parent.AC6_Stock_Sound.Rev:Play()
else
script.Parent.IsOn.Value = false
script.Parent.AC6_Stock_Sound.Rev:Stop()
end
end
end
--Stuff that basically gets the service to run the script
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
This is what the AC6_Stock_Sound script looks like.
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local redline=0
script:WaitForChild("Rev")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
else
car.DriveSeat.Rev.Pitch = Pitch
end
end
