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

How to make music play locally when a player joins?

So for the past hour I've been trying to make a script which when a player joins it plays a little intro music piece locally. I suspect the error is in the player part but I'm not so sure.

local player = game.Players.LocalPlayer
local sound = game.Workspace.Intro

player.PlayerAdded:connnect(function()
	sound:Play()
	
end)

2 comments

0

Or possibly the PlayerAdded part in the localscript.

0

You can’t use PlayerAdded on the LocalPlayer, it can only Fire on the actual Player Service, rewrite line one to: game.Players

1 answer

✓ Accepted answer

You cant call a local player in a script because the script is on the server not client. Make it so the script fires a remote event to the players client. After that have a local script playing the sound when the remote event is fired. I recommend having the sound in ReplicatedStorage.

3 comments

0

Okay, thanks. I'll try that right now.

0

The Sound must be in workspace to work.

0

The Issue is also because he’s trying to use a Service Event on the LocalPlayer, this could’ve easily been resolved with rewriting line one to: game.Players

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