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 11 years ago

Here:

1x = game.Lighting
2song1 = x.Song1
3 
4 
5script.Parent.MouseButton1Click:connect(function()
6    s = song1:Clone()
7    s.Parent = game.Workspace
8    s:Play()
9end)

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
11 years ago

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

1soundA = game.Players.LocalPlayer.StarterGui.SoundName --I don't Recommend using Numbers
2 
3script.Parent.MouseButton1Click:connect(function()
4    soundA:Play()
5end

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

1soundA = game.Players.LocalPlayer.StarterGui.SoundName --Same as from above
2 
3script.Parent.ClickDetector.MouseClick:connect(function()
4    soundA:Play()
5end

Also, in the LocalScript.

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

Ad

Answer this question