Indoor and outdoor sound
how can I make that the wind is not heard in the building but it can be heard outside (like in this game)?

There’s quite a few different methods for doing this.

  1. One way is to detect whenever the humanoid moves to another floor material and then get what the humanoid is currently standing on.

    So if the floor of the house is made of wooden planks, you stop the sound for the player whenever the humanoid.floormaterial is woodplanks.

  2. Another method is to fire a ray downwards (or upwards if you like) from the player after a specific set of time and find whatever is below (or above) the player. So if the ray hits, say the floor, you can stop playing the sound for that player as he’s indoors.
    Intro to Raycasting
    (Although personally I’d prefer method 1)


Yes, but there, even if standing in the bus, move the camera out of the window to the street, the wind will be heard. Visit this game

1 Like

In that case, you could get the cameras current position workspace.CurrentCamera.CFrame.Position , then raycast downwards (or upwards) from the camera position every frame using RunService.RenderStepped to check what part the ray hits. And if the part the ray hits is considered to be inside, stop playing the sound.

i don’t understand. help pls :frowning_face:

The way the system works is by using raycasting, as @amadeupworld2 mentioned already. Here is a basic example of how to do a raycast from the camera:

-- This is a LocalScript in StarterPlayerScripts --
local cam = workspace.Camera

    local rayResult = workspace:Raycast(cam.Position,, 1, 0) * SOMEDISTANCE) -- Casts straight upwards to find a ceiling
    if rayResult then
        -- Indoors --
        -- Probably outdoors --

I’m not sure how Bus Simulator specifically does their dynamic sounds, but I do know that some games (like Celeste shown here) use some sort of low-frequency EQ effect when you’re underwater. This might be able to give you the ability to continue using the same sound for the inside with an added muffling effect. If you add an EqualizerSoundEffect object to a Sound object, you can adjust the HighGain, MidGain and LowGain until you get audio that sounds like you’re inside. From there, you could use TweenService to animate your EqualizerSoundEffect's high/mid/low gain properties to their appropriate values. If you don’t want to use TweenService, you can just set them directly just like you would normally with properties.