Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.