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

Player Enters, only they hear the music from the beginning? [ SOLVED ]

I'm a beginner when it comes to scripting, and I noticed when I use this script in my game, every time someone enters, it repeats, and it replays the beginning each time. I want it so only the person who has entered the game hears this music from the beginning, and not everyone who has already spawned. Can someone give me some tips or advice on how to do this? I think it may have something to do with LocalPlayer, not sure though..Thanks!

Script:

game.Players.PlayerAdded:connect(function()
	wait(23.5)
song = script.Parent
	script.Parent:Play()
	script.Parent.Looped = true
	
	end)

2 answers

✓ Accepted answer

To make music play for only one person, clone a sound to their PlayerGui:

game.Players.PlayerAdded:connect(function(player) -- Player parameter
    wait(23.5)
    song = script.Parent:clone() --Clone the sound
    song.Parent = player.PlayerGui -- Parent it to the PlayerGui
    song:Play()
    song.Looped = true
end)

2 comments

0

Thank you!

0

No problem.

Make the song play in their PlayerGui when they enter

1 comment

0

Sorry but, how would I do this?

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