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.
1 | local player = game.Players.LocalPlayer |
2 | local sound = game.Workspace.Intro |
3 |
4 | player.PlayerAdded:connnect( function () |
5 | sound:Play() |
6 |
7 | end ) |
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.