Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a sound ambient? And part touch play sound?

Asked by 11 years ago

Would the ambient sound script be like this :

1local sound = game.Workspace.Sound
2sound:Play()
3If huminoid 4 away then sound volume
4value 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.

1If Hit(OnTouch)
2Part
3Then game.Workspace.Sound
4sound:play()

1 answer

Log in to vote
1
Answered by
Hybric 271 Moderation Voter
11 years ago

** touch a part and play:**

1function hit(p)
2local h = p.Parent:findFirstChild("Humanoid")
3if (h ~= nil) then
4Workspace.Sound:Clone().Parent = script.Parent
5script.Parent.Sound:Play()
6end
7end
8 
9script.Parent.Touched:connect(hit)

Thats all you need, when you walk away from a sound thats in a part it fades away.

0
I will am new to scripting, but i am good at building. Thank you for getting me ever so closer to knowing scripter, i'm still learning about functions and other terms but thank you for teaching me about sound. arjun9022 34 — 11y
Ad

Answer this question