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

How do I make a sound that plays separately for each individual player?

Asked by 9 years ago

I've already found a somewhat cheap way to do this. I inserted an invisible uncollidable part and inserted the following script:

local debounce=false
local sp=script.Parent

function T(hit)

local h=hit.Parent
local p=h.Name
local g=game:GetService("Players")

local h=g:findFirstChild(hit.Parent.Name)

if debounce==false then h.PlayerGui.Folder.Music2:Stop() end
if debounce==false then h.PlayerGui.Folder.Music:Play() end
debounce=true
wait(1)
debounce=false
end
script.Parent.Touched:connect(T) 

There's a folder inside startergui that has all the music files I need. It stops all other music and starts up the one to be played.

This method works, but I'm searching for a better one. Please Help.

0
If it works why do you need a better one? atleast it works right. Well if there is a better option I would go for it. Hero_ic 502 — 9y
0
You still haven't explained when you want the sound to play, how many music you have, or any other relevant information. Lacryma 548 — 9y
0
On second thought the quantity does not matter. However, when do you want this to happen? Lacryma 548 — 9y
0
Have you thought about using remote events? User#3 0 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Use GUIs, Yes I have done this many times before.

I put the sound objects into player's GUI and then play it, This way the sound is heard only to that individual player :O

Ad

Answer this question