leaderstats script
local Players = game:GetService(“Players”)
–Function–
local function leaderboardsetup(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
The server can’t play sounds in SoundService, the playback won’t replicate. Place it somewhere else or make clients play the sound on their end instead. The latter is a better option than the former.
The server is represented by Scripts and the client is represented by LocalScripts. It may help you to know the client-server model not just for this case but in the future as well. The Developer Hub is a good source to do research at if you don’t know certain things. You can then confer with other resources for additional help understanding programming topics.
Sounds are heard from a client’s machine, that being the device they are using - computer, laptop, tablet, phone, whatever. The server, on the other hand, does not have a concept of “hearing”. I’m not particularly sure what the rules are but Scripts cannot play sounds in SoundService. Therefore, you need to play them from a LocalScript or a different location like Workspace.
When did people start putting sounds in SoundService? I didn’t even know you could do that. Somebody posted last week having problems getting a playlist to work and he was storing his sound files in SoundService.
SoundService can be considered a canonical location for placing and working with sounds that do not require emission in the 3D world. I personally use it for SoundGroups and music because it’s a convenient place to store and access them for a wide variety of purposes, including granular volume settings. A whole lot better than the Workspace or some other obscure location. The only important thing to keep in mind is this issue where Scripts cannot play sounds from there.