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

How can I make this script to play in the local player?

Asked by 10 years ago

Here:

x = game.Lighting
song1 = x.Song1


script.Parent.MouseButton1Click:connect(function()
    s = song1:Clone()
    s.Parent = game.Workspace
    s:Play()
end)

It works but for everyone in the server so how can i make it to play in the local player? Please help thanks.

1 answer

Log in to vote
0
Answered by
KAAK82 16
10 years ago

put the Sound into StarterGui. if it's a Gui Button then

soundA = game.Players.LocalPlayer.StarterGui.SoundName --I don't Recommend using Numbers

script.Parent.MouseButton1Click:connect(function()
    soundA:Play()
end

make sure this Script is in a LocalScript not a Normal one... else though, if it's in a Brick then

soundA = game.Players.LocalPlayer.StarterGui.SoundName --Same as from above

script.Parent.ClickDetector.MouseClick:connect(function()
    soundA:Play()
end

Also, in the LocalScript.

Edit: I forgot that ClickDetector's have MouseClick not MouseButton1Click.

Ad

Answer this question