Hello, when I enter the car and get very light the second time I leave the car does not stop the fire and sound, it is like not entering the function to touch, does anyone know why? .
Car.PrimaryPart.Touched:Connect(function(touch)
if touch.Parent:FindFirstChild('Humanoid') then
fire.Enabled = true
soundEngine:Play()
soundEngine.Looped = true
soundEngine.Volume = 1
lucesd.Material = Enum.Material.Neon
while wheel1 and wheel2 do
wait (0.05)
local wlsp = ((wheel2.RotVelocity + wheel1.RotVelocity)/2).magnitude
local wlsp2 = ((wlsp / 200) + idlespeed) * mult
if wlsp2 < maxpitch then
soundEngine.Pitch = wlsp2
else
soundEngine.Pitch = maxpitch
end
end
end
end)
Car.PrimaryPart.TouchEnded:Connect(function(touchEnd)
if touchEnd.Parent ~= playerLocal then
Ground.Touched:Connect(function(touch)
if not debounce then
debounce = true
if touch.Parent:FindFirstChild('Humanoid') and touch.Parent.Name ~= "Enemy" then
soundEngine:Stop()
fire.Enabled = false
end
wait(2)
debounce = false
end
end)
Ground2.Touched:Connect(function(touch)
if not debounce then
debounce = true
if touch.Parent:FindFirstChild('Humanoid') and touch.Parent.Name ~= "Enemy" then
soundEngine:Stop()
fire.Enabled = false
end
wait(2)
debounce = false
end
end)
end
end)

4 comments
Have you tried using debounce and defining variables?
Do you think it's because of the variable debounce? it is false by default.
solved lower the wait () to 1 second instead of 2 and it works that nonsense hahahaha
Thank you