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

Song not playing on player join?

I am new to roblox scripting so don't judge. So I am making a game and I want music to play when a player joins. So I made this script:

game.Players.PlayerAdded:Connect(function(Player)
	script.Parent:Play()
	script.Parent.Looped = true
	end)

I am storing my songs in ReplicatedStorage in a Songs folder with the parent as the audio and the parent of the audio being the folder.

Please help.

2 answers

✓ Accepted answer

You should store the sound and the local script on StarterPlayerScripts and itll replicate to the player and play it locally

The reason this doesnt work right now is because you’re trying to run a script on replicatedstorage and you cant do that, its used only for storage and local/server scripts wont run on it, only module scripts will

EDIT:

Actually there is no script needed at all.

Put your sound on PlayerStarterScripts and check the Looped property and the Playing Property.

Try inserting the LocalScript into StarterPlayerScripts, and do the following:

local SoundService = game:GetService("SoundService")

script.Parent.Changed:Connect(function(property)
	if property == "Name" then
		local Sound = Instance.new("Sound",SoundService)
		Sound.Name = "MySound" -- Optional
		Sound.MusicId = (music id)
		Sound.Looped = true
		Sound:Play()
	end
end)

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