I want to locally play music through clicking a TextButton on a surface GUI. The sound would only play for the player who clicked.
✓ ANSWER ACCEPTED
How do I locally play a sound through a surface GUI?
1 answer
✓ Accepted answer
First, you should probably make sure the sound is in the player. You can do this by copying the sound and placing it into the local player. There are other ways, but I found this most simple. Next, just play the sound using a local script. That's all you have to do really. Here's some example code below,
--- Make sure this is in a local script
local player = game.Players.LocalPlayer--Can only do this with a local script
local sound = game.ServerStorage:WaitForChild("Sound") -- define the sound
local SoundCopy = sound:Clone() -- clone the sound
SoundCopy.Parent = player -- put it in the local player
SoundCopy:Play() -- play the copy
Hope that helped! Good luck!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Where would you find the local player?
I updated my answer with an examples. Also, make sure to except the answer if it helped so we both get reputation.