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

How to play a song to only a specific player?

I'm designing a congratulations GUI for when a player levels up. I want an audio to play but I only want the player that leveled up to hear the audio. How can I achieve this?

1 comment

0

Just put the sound inside the player or their character

2 answers

✓ Accepted answer

This is fairly easy to do. Simply parent the sound instance inside the player's PlayerGui and play it. The sound will be local.

game.Players.PlayerAdded:connect(function(player)
	local sound = Instance.new("Sound", player)
	sound.Name = "LocalSound"
	sound.SoundId = "rbxassetid://00000000"
end)

1 comment

0

Thank you

If it's only for a specific player, you put it where the client is. So, put it in PlayerGui or something in the 'Players' section and not in the Workspace as nearby players will hear. Putting it in PlayerGui will make the sound replicate only to the player.

local Player = game:GetService("Players").LocalPlayer
local Sound = Player.PlayerGui.ASound:Play()

1 comment

0

What dragonmaster4111 did.

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