Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Equalizer audio effect won't change?

Asked by 4 years ago
Edited 4 years ago

I'm trying to make it so the further a player gets from an object, the audio inside will become muffled via an equalizer effect. I've done this before with one object, but the script I'm trying to use grabs multiple objects and I'm unsure on how to find the player's distance in relation with each object. Here's the script:

for i,v in pairs(workspace.Speakers:GetChildren()) do
        if v:IsA("MeshPart") then
            muffle.HighGain =    game.Players.LocalPlayer:DistanceFromCharacter(v.Position)*-1
            muffle.MidGain = game.Players.LocalPlayer:DistanceFromCharacter(v.Position)*-1
        end
    end

Answer this question