Don't know how to put the Instance into the Player...
Someone help me?
function onPlayerEntered(newPlayer) -- I don't know how to put the Instance into the Player... local s = Instance.new("Sound") s.Name = "Music" print("1") s.Volume = 1 s.Looped = true print("2") s.SoundId = "rbxassetid://142896835" s.IsPaused = false s.IsPlaying = true print("3") end game.Players.ChildAdded:connect(onPlayerEntered)
There is a second argument for the Instance.new method
, it returns the parent of the Instance. So in your script, to parent it to the player we'd go like..
local s = Instance.new("Sound",newPlayer) --[[ We use the parameter from your function you're using for the PlayerAdded event ]]--
But I'm assuming that you want this sound to be heard, correct? Then you need to parent it to not the player, but the Player's PlayerGui.
local s = Instance.new("Sound",newPlayer.PlayerGui)
But also, you neglected to play the Sound in your script.. So your whole script should look like;
game.Players.PlayerAdded:connect(function(newPlayer) wait(1) --just for safety(; local s = Instance.new("Sound") s.Name = "Music" print("1") s.Volume = 1 s.Looped = true print("2") s.SoundId = "rbxassetid://142896835" s:Play() --We play the ausio with the 'Play' method. print("3") end)