I want to make a object that when it gets close to a part with a certain name it plays an audio, the thing is that I want multiple parts to be around the map and have the object play the audio whenever it's around the part. I don't really know how to explain it well but basically I need some help with the getchildrenw which gets stuff from a folder in workspace. Here's the code. Thanks for viewing C:
while true do
local partfind = game.Workspace.TestSound:GetChildren()
local nfs = (script.Parent.Position - partfind.partSound.Position).magnitude
----The coding under this text is fine----
if nfs <= 10 then
script.Parent.Soundl1.PLFFF.Disabled = false
script.Parent.Soundl1.PLFFF2.Disabled = true
wait()
end
if nfs >= 9 then
script.Parent.Soundl1.PLFFF.Disabled = true
script.Parent.Soundl1.PLFFF2.Disabled = false
wait()
end
wait()
end

1 comment
I don't know if you'll see this message or reply but in the output box it says "Workspace.ROOF.soundPlay:5: bad argument #2 to '?' (Vector3 expected, got nil)"