Would the ambient sound script be like this :
1 | local sound = game.Workspace.Sound |
2 | sound:Play() |
3 | If huminoid 4 away then sound volume |
4 | value 0.1 |
I don't know if this is right, but i want the sound to get quieter as you walk away.
So basically i need to add a part where if the player walks farther away, the sound gets quieter until it's silent,
And also can i add a script where if a player touches a part it creates a sound.
1 | If Hit(OnTouch) |
2 | Part |
3 | Then game.Workspace.Sound |
4 | sound:play() |
** touch a part and play:**
1 | function hit(p) |
2 | local h = p.Parent:findFirstChild( "Humanoid" ) |
3 | if (h ~ = nil ) then |
4 | Workspace.Sound:Clone().Parent = script.Parent |
5 | script.Parent.Sound:Play() |
6 | end |
7 | end |
8 |
9 | script.Parent.Touched:connect(hit) |
Thats all you need, when you walk away from a sound thats in a part it fades away.