Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
bloxxyz 274 Moderation Voter
9 years ago

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

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
9 years ago

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)
0
Thank you! bloxxyz 274 — 9y
0
No problem. Sublimus 992 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

Make the song play in their PlayerGui when they enter

0
Sorry but, how would I do this? bloxxyz 274 — 9y

Answer this question