Problem with sound hearing for everyone please help

How do you think we’re supposed to know what is causing the problem, unless you give your output error log. And it also doesn’t seem like you have followed up with the code provided to you, as it just seems like you’re using your original code.

1 Like

I used the script what this guy sayed

My script never has script.Parent.Touched anywhere in it so you are not using the script I gave you.

Edit: My script has part.Touched and what you just showed me says script.Parent.Touched

local sound = game.Workspace.SoundLibrary.Scream
local part = game.Workspace.Coin
Part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Get player if there

 if player **script.Parent.Touched**:Connect(function(hit) then
      Sound:Play() --Play Sound if player had touched.
 end

end)

Alright alright, he claims the sound was for everyone before this topic was created.

Since doing it in the local didn’t work, you should instead make a remote event then make the script (must be regular type) fire the server, inside the extra local script which handles the events of remote event, it should play the sound, it is that easy, @do0gdemon.

You also don’t need to transport the player variable from the server since the local already has it taken care of.

local sound = game.Workspace.SoundLibrary.Scream
local part = game.Workspace.Coin
Part.Touched:Connect(function(hit)
     local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Get player if there

     if player then
          Sound:Play() --Play Sound if player had touched.
     end
end)

This code will work just fine so copy and paste this in.

Also for reygenne I think your suggesting game.Players.LocalPlayer but that would not work since anything could hit it and it would trigger the event(if your not suggesting this mb), I say this because you said “you don’t need to transport the player variable from the server since the local already has it taken care of.”

1 Like

Read what he wrote in the post, not copy paste, use some logic while implementing. Doesn’t seem like you’re familiar with how the code is actually working.


@reygenne1 As mentioned in the topic, he wants to play it for the local player only. So there isn’t need of a remote event imo, he can just connect it from client side.

It doesn’t work idk why. Okey 1. The local script is in startergui i copy pasted what you write. Its showin errors In
local sound = game.Workspace.SoundLibrary.Scream
local part = game.Workspace.Coin
Part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Get player if there

 if player then
      **Sound**:Play() --Play Sound if player had touched.
 end

end)
So its showing errors in “Part” and “Sound”

they need to be lower case since the variable is lower case.

Once again I recommend you learning lua.

1 Like

Yes i maked that but still it doesn’t work

What about it does not work? You need to give me information lol.

So it does not make sound when you touch it and it doesn’t make any errors too in the output

Your localscript is probably not parented correctly and therefore not even executing. See the top of this link on where localscripts need to be parented to execute.

Even if that’s not the case, you seriously need to learn some basic debugging. You can figure out if the script is running with a simple print statement at the top. Similarly, you can put a print statement inside of an event to determine if it fires as expected (Touched is the event here).

That means less of saying “it didn’t work” and more of actually reading the errors and trying to understand them. You should probably read About the Scripting Support category. Beginner or not, you need to actually put more effort into getting it to work yourself.

1 Like

There is not solution for this problem ooof. I have tried to make this like 3 hours!

Can someone help please i this is really hard!? PLEASE :frowning:

Really? Because the script @WaterJamesPlough gave works fine. Here’s proof of it working in my studio:

Here’s the important pieces in the Explorer:

And here’s the script:

local Part = workspace.NoisePart
local Sound = workspace.TouchSound

Part.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Get player if there 

	if player then
		Sound:Play()
	end
end)
3 Likes

To get a solution you need to use some of your logic, and also collaborate properly. Which I don’t see in here, all I see is you copy pasting the code we give as an example and then complain about it not working instead of giving the error log. I really don’t know how you expect help in this way.

1 Like

Thanks for help I would have been really stresfull and i did not eat today, so my brains are not working as easy as this oof. Please all who read understand this. In next time I will not ruin codes for copy paste i will first try make it my self then search if have solution then try search in youtube and if I make topic I will try work on team.
Have a nice dayy all( all peoples in this forum are really kind)
Thanks for helping me out and thanks for solution!