| |
|
| |
|
| | local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
| | local SoundService = game:GetService("SoundService")
|
| |
|
| | local SoundConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("SoundConfig"))
|
| | local SoundEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("SoundEvent")
|
| |
|
| |
|
| | local ambientGroup = Instance.new("SoundGroup")
|
| | ambientGroup.Name = "Ambient"
|
| | ambientGroup.Volume = SoundConfig.AmbientVolume
|
| | ambientGroup.Parent = SoundService
|
| |
|
| | local sfxGroup = Instance.new("SoundGroup")
|
| | sfxGroup.Name = "SFX"
|
| | sfxGroup.Volume = SoundConfig.SFXVolume
|
| | sfxGroup.Parent = SoundService
|
| |
|
| |
|
| | local forestSound = Instance.new("Sound")
|
| | forestSound.Name = "ForestAmbient"
|
| | forestSound.SoundId = SoundConfig.ForestAmbient
|
| | forestSound.Looped = true
|
| | forestSound.Volume = 0.3
|
| | forestSound.SoundGroup = ambientGroup
|
| | forestSound.Parent = workspace
|
| |
|
| |
|
| | forestSound:Play()
|
| |
|
| |
|
| | SoundEvent.OnServerEvent:Connect(function(player, soundName, position)
|
| |
|
| | if SoundConfig[soundName] then
|
| | for _, otherPlayer in ipairs(game:GetService("Players"):GetPlayers()) do
|
| | if otherPlayer ~= player then
|
| | SoundEvent:FireClient(otherPlayer, soundName, position)
|
| | end
|
| | end
|
| | end
|
| | end)
|
| |
|
| |
|
| | _G.PlayWorldSound = function(soundName, position)
|
| | for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
|
| | SoundEvent:FireClient(player, soundName, position)
|
| | end
|
| | end
|
| |
|
| | print("Soundscape Manager initialized")
|
| |
|