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

How to make Personal Audio?

Asked by 10 years ago

Hello, I've been experimenting with sound, though I've ran into a bit of a problem. I'm making a song playlist, and it plays different songs based on what you click. My current script works, though I would prefer it to only play to the player who clicked the button. Currently, it plays to everyone.

Essentially, I want the song playing only to the person who clicked, rather than everyone.

Currently I have this script:

radioactive = game.Workspace.radioactive
happy = game.Workspace.happy
function radioactiveF()
    if radioactive.IsPlaying ~= true then
        happy:Stop()
        radioactive:Play()
    else
        radioactive:Pause()
    end
end

function happyF()
    if happy.IsPlaying ~= true then
        radioactive:Stop()
        happy:Play()
    else
        happy:Pause()
    end
end

script.Parent.radioactive.MouseButton1Click:connect(radioactiveF)
script.Parent.happy.MouseButton1Click:connect(happyF)

1 answer

Log in to vote
0
Answered by 10 years ago

Put the sounds in the PlayerGui, If they are in the Player or PlayerGui they play for the player only

radioactive = script.Parent.Parent.Parent.Parent.radioactive --Im not sure the hierearchy, but this is just what im putting
happy = script.Parent.Parent.Parent.Parent.happy
function radioactiveF()
    if radioactive.IsPlaying ~= true then
        happy:Stop()
        radioactive:Play()
    else
        radioactive:Pause()
    end
end

function happyF()
    if happy.IsPlaying ~= true then
        radioactive:Stop()
        happy:Play()
    else
        happy:Pause()
    end
end

script.Parent.radioactive.MouseButton1Click:connect(radioactiveF)
script.Parent.happy.MouseButton1Click:connect(happyF)

Ad

Answer this question