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

How can i make sound play on custom range?ou [closed]

Asked by 9 years ago

How can I make sound play on custom range?

0
You can try changing the volume property. bobafett3544 198 — 9y

Locked by BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 9 years ago

Make a song in workspace called Sound. Make sure it doesn't run at start and is Pitch 1.

I actually don't know, but... The best is to, make hidden parts, and put the sound into each player's PlayerGui using this simple localscript in StarterGui:

local Player = game:service('Players').LocalPlayer

local Song = game:service('Workspace'):findFirstChild('Sound'):Clone()
Song.Parent=Player.PlayerGui
Song:Play()

Now, this is the script (Normal one) you put inside the 'ghost walls' you made:

script.Parent.Touched:connect(function(part)
   if part.Parent:findFirstChild('Humanoid')~=nil then
   local Pl = game:service('Players'):GetPlayerFromCharacter(part.parent)
      if (Pl~=nil) then
        Pl.PlayerGui.Sound:Destroy()
      end
  end
end)

Hope this helps! If not tell output! If it helps and works please make this correct answer :333 ~marcoantoniosantos3

0
Change findFirstChild to FindFirstChild vincius0000 0 — 9y
0
@above there is actually no difference in that... It's the same method. If you wanna make code your way, change it in your code, but ill code in my way marcoantoniosantos3 200 — 9y
Ad