Sound not playing, when parented to PlayerGui

So I’m making a Backrooms game, with levels and I just started to make Level 1. I want to achieve that every level has its unique sounds. The problem is that when a player gets to another level, the music of that level stops and the sound of the new level can be heared by every player. I’m trying to make that when a player exits a level, the music only stops to the player.

This is what I tried:

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Wait()
	local Leaderstats = Instance.new("Folder", plr)
	Leaderstats.Name = "leaderstats"
	
	local CurrLevel = Instance.new("StringValue", Leaderstats)
	CurrLevel.Name = "CurrentLevel"
	CurrLevel.Value = "Level 0"
	
	local spawns = workspace.Map.Level0.Spawns
	local AvailableSpawnPoints = spawns:GetChildren()
	local Pos = math.random(1,#AvailableSpawnPoints)
	local spawnPoint = AvailableSpawnPoints[Pos]
	plr.Character.HumanoidRootPart.CFrame = spawnPoint.CFrame + Vector3.new(0,10,0)
	
	players[plr.Name].PlayerGui:WaitForChild("Ambience"):Play()
	players[plr.Name].PlayerGui["Fluorescent Light Humming Sound Effect"].Playing = true
end)

The sounds are in PlayerGui, but they doesn’t play.
How can I make this work?

I dont think that you can play sounds by parenting it on a playerGUI

This is a local script, right? Also use :Play() for the last sound effect.

This is ServerScript. It found PlayerGui, but not the sound

Try switching to a local script.

It works! I have one more question. If the sound in PlayerGui is stopped, does it stop for everyone or only the localplayer?

If its a local script, everything you do can only affect the client. So, yes.

1 Like