Player sound is not being disabled

I can’t disable the sound on a player that joins the game.

No errors in the console or anything. Please help!

Script
1. local Players = game:GetService("Players")

2. Players.PlayerAdded:Connect(function(Player)
3. 	
4. 	if Player ~= nil then -- Check if Player is not equal to Nil
5. 		
6. 		local Character = Player.Character or Player.CharacterAdded:Wait() -- Get the character
7. 		
8. 		local HRP = Character.HumanoidRootPart
9. 		
10. 		for _, v in pairs(HRP:GetDecendents()) do -- Look all inside children of HumanoidRootPart
11. 			
12. 			if v:IsA("Sound") then -- Check if v is a sound class
13. 				
14. 				print(v.Name)
15. 				v.Volume = 0 -- Disable The Sound
16. 				
17. 			end
18. 			
19. 		end
20. 		
21. 	end
22. 	
23. end)

I’m guessing this is a ServerScript? Are there any Output messages that are printed?

1 Like
for _, v in pairs(HRP:GetDecendents()) do -- Look all inside children of HumanoidRootPart
11. 			

its :GetDescendants()

why didn`t this error?

2 Likes

Yeah the first error its :GetDescendants()

Then probably, the sounds instances are not created when Player join, so you gotta use on character added binded to player join

1 Like

ok so afbeelding
this is an image from the serverside of my characters humanoidrootpart…

see something missing???
i didnt know this either until i started to ask my self… why would the server create sound

gues you have to make it a local script

2 Likes

True @boeljoet is right.
Server side has no access to those sounds, looks like only can be accessed localy

1 Like

I made a reply regarding this issue awhile ago. If sounds aren’t in the HumanoidRooPart, then they are probably in StarterCharacterScripts (or StarterPlayerScripts). Original reply below:

What I did was I ran a test then went into the StarterPlayer. From there I opened the StarterPlayerScripts (or StarterCharacterScripts. I can’t remember which one). After that, I copied one of the module scripts in there. I can’t remember which one it is, and I don’t have access to a computer at the moment. Basically just copy those scripts and end the test. After that paste them into the StarterPlayer and look for all the character sounds. Replace the character death sound with either nothing or another ID that you want to play. I believe this method is called forking.

1 Like

Test this one, works fine. Its a Local Script inside StarterCharacterScripts:

local Players = game:GetService("Players")
local Playa = Players.LocalPlayer

local HRP = Playa.Character.HumanoidRootPart
for _, v in pairs(HRP:GetDescendants()) do
	print(v)
	if v:IsA("Sound") then
		print(v.Name)
		v.Volume = 0
	end
end
2 Likes

What’s weird is that I left this post while I slept overnight lol