Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

Would the ambient sound script be like this :

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

If Hit(OnTouch)
Part
Then game.Workspace.Sound
sound:play()

1 answer

✓ Accepted answer

** touch a part and play:**

function hit(p)
local h = p.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
Workspace.Sound:Clone().Parent = script.Parent
script.Parent.Sound:Play()
end
end

script.Parent.Touched:connect(hit)

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

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.