When a team spawns, I want it to play a sound as a server-side, but this sound will only be played once. I tried to get help on the internet or from a few people, but none of them went the way I wanted. So how exactly should I write a working script for this?
Insert the sound you want to play into a brickYou should keep a count. When the first player joins and a signal is sent to the server.
local plrs = 0 local sound = workspace.brickwithsound.sound local event = game.ReplicatedStorage.remoteevent local gameover = game.ReplicatedStorage.gameover local function OnPlrJoin(plr) print(plr .. " joined.") if plrs == 0 then sound:Play() end plrs = plrs + 1 end local function GameOver() plrs = 0 end gameover.OnServerEvent:Connect(GameOver) event.OnServerEvent:Connect(OnPlrJoin)
Sorry if this was bad.