Use the “SoundService” storage to put global sounds in it.
Sounds are replicated from where the sound is placed.
If the sound isn’t in a physical object (part, mesh) then it will be global (everyone will hear it).
If the sound is in a physical object, then it will played from this part (so you can hear it only if you’re close to it, depending of the “RollofMaxDistance” and “RollofMinDistance” sound properties settings).
If you want that everyone can hear the sound, it need to be played in server side using a script and not a local script.
Add a “Remote Event” in the replicated storage, Rename it “SoundReplication”
Add a “Script” inside the “ServerScriptService”
Don’t forget to change the “RollOffMin and Max distance” of your sound (5 for min and 35 for max should be fine)
Local Script code:
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Sound = game.SoundService:WaitForChild("Long" ,30)
local Root = Character:WaitForChild("HumanoidRootPart" ,30)
local Event = game.ReplicatedStorage:WaitForChild("SoundReplication" ,30)
local Cooldown = false
if Sound ~= nil and Root ~= nil and Event ~= nil then
script.Parent.MouseButton1Click:Connect(function()
if Cooldown == false then
Cooldown = true
Event:FireServer(Sound, Root)
wait(0.5) --cooldown to avoid spam click
Cooldown = false
end
end)
end
Script code:
local Event = game.ReplicatedStorage:WaitForChild("SoundReplication" ,30)
if Event ~= nil then
Event.OnServerEvent:Connect(function(Player, Sound, Root)
coroutine.resume(coroutine.create(function()
-- Coroutine = as there is a wait time in the script, it is in case if multiple sounds are played on differents players at same time, allow the script to be played multiple times at once.
local Clone = Sound:Clone()
Clone.Parent = Root
Clone:Play()
wait(0.5)--SoundTime
Clone:Destroy()
end))
end)
end