I am attempting to achieve an effect so when a player is indoors an equalizer that is a member of a sound is enabled and then when the player is outdoors it is disabled. I’m using a raycast to try and achieve this, though I’m not 100% that this is the best method to tackle this effect. I will take suggestions.
But currently the issue is i’m trying to make this ignore players, this is the current code:
local soundService = game:GetService("SoundService")
local cam = workspace.CurrentCamera
game:GetService("RunService").Heartbeat:Connect(function()
local rayResult = workspace:Raycast(cam.CFrame.Position, Vector3.new(0, 1, 0) * 100)
if rayResult then
soundService.Ambience.Day.IndoorEqualizer.Enabled = true
soundService.Ambience.Night.IndoorEqualizer.Enabled = true
soundService.Ambience.Wind.IndoorEqualizer.Enabled = true
else
soundService.Ambience.Day.IndoorEqualizer.Enabled = false
soundService.Ambience.Night.IndoorEqualizer.Enabled = false
soundService.Ambience.Wind.IndoorEqualizer.Enabled = false
end
end)
I’ve looked around for solutions and have found many things but they don’t seem to work maybe they are more suited for server sided scripts. Not sure this is open to any suggestions that are helpful, thanks!