Hello
I try to play a sound globally (like all the player near the part will be able to hear it, but i’m pretty much stuck, because no sound is player.
(I have a Script in ServerScriptService that manage my traps. but the sound isn’t played.
If somebody can also explain to me, what do i need to change to change the radius of the sound.
Here is the script in ServerScript:
-- << Variables >> --
local TweenService = game:GetService("TweenService")
local StockFolder = game.Workspace.Levels.Level1.Traps.FakePillars
local PillarsTable = StockFolder:GetChildren()
local breakingSound
local Tw_Info = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.In,
0,
false,
0
)
-- << Function >> --
for i, v in pairs(PillarsTable) do
local Detector = v:FindFirstChild("Detector")
Detector.Touched:Connect(function(ReturnPart)
local humanoid = ReturnPart.Parent:FindFirstChild("Humanoid")
if humanoid then
local breakingSound = v.Detector.BreakSound ------Here is the sound
humanoid.Health = 0
breakingSound:Play() -----Here is the sound played
local Pillar_Debris = game.ReplicatedStorage.Debris:Clone()
Pillar_Debris.Parent = game.Workspace.Levels.Level1.Temporary
Pillar_Debris.Position = v.PrimaryPart.Position + Vector3.new(0,-4.5,0)
v:Destroy()
wait(1)
local Tween_Result = TweenService:Create(Pillar_Debris,Tw_Info, {Transparency = 1})
Tween_Result:Play()
Tween_Result.Completed:Connect(function()
Pillar_Debris:Destroy()
end)
-- WAIT A BIT, CLONE OBJECT
end
end)
end
And here is the explorer:
So the sound need to be played before the pillar is destroyed
1 Like
Try to set the sound’s PlayOnRemove
property to true
and remove breakingSound:Play()
This doesn’t change anything.
I don’t know why the sound isn’t played.
My sound is on the workspace inside a folder. (attached to a part) but why does that sound is not play.
Change TimePosition to 0. I think this is solution.
2 Likes
Nice thanks u very much , i’ve been struggling with this for a long time.
Then like that other player will hear it ? and what is the property then to change the “radius” where the sound is audible.
yes seems to be that.
Because i look at the property of the sound but i was lost x).
I will try that later thanks!
1 Like
After some test, yes it’s this property, but i’m having a issues, when my player go beyond this limit, the sound just cut himself without any fade or something ( i try reading this aboute Sound.RollOffMode) but i don’t understand the difference and how can i fix that ?
Thanks
Its because Sound.RollOffMinDistance
should be less than Sound.RollOffMaxDistance
.
If your Sound.RollOffMaxDistance
is 100 then set Sound.RollOffMinDistance
to 90 or less.
1 Like
yes i read and test a lot about that, but still if my player go beyond the limit of Sound.RollOffMinDistance, then the sound stop.
Here is the properties:
You probably need to remove this sound from part or attachment and put it in other place. (it should not be a descendant of the part or attachment.) Then in script you need to write a new way to the sound and play it. This probably will not be affected by distance and will not be a “3D” sound, but you can write your own script that will fade sound’s volume based on distance from Detector brick. I hope this will help.
1 Like
Thanks for your answer. I will try. Again thanks for all.