So! I've been searching for a script 2 days now. But i can't find a solution.
the thing i need: A script that plays a sound localy.
But, whatever i try. I can't do it right.
I've tried:
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playerGui = player:WaitForChild("PlayerGui")
playerGui.M3:Play()
(Full script that's required!)
Playing = 0
Gestart = 0
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
print(player)
wait()
if( Gestart == 0) then
Gestart = 1
print("Gestart11")
wait()
if( Playing == 0) then
Playing = 1
print("Playing22")
(IS SHOULD BE TRIGERED FROM HERE. I've tried this in a LocalScript and in a normal script
local playerGui = player:WaitForChild("PlayerGui")
wait(script.Parent.WT.Value)
playerGui.SoundFolders.SoundFolder1.M3:Play()
end
end
end
script.Parent.Parent.Starter.Touched:connect(onTouched)
Thanks for helping guys!

8 comments
Thank you! So, i've created the first script as an LocalScript inside the brick. But where do i need to place the second script? Inside the Gui which contains all the sound? or how?
Oh wait. Nevermind. i've placed it in ReplicatedStorage. But from line 09 i don't know how to acces the player's PlayerGui. I'm fully new to remoteacces and others.
The first script is supposed to be server scripts or regular scripts, and is inside the brick that you want to touch. The second script put in PlayerGui as a LocalScript. Change line 9 of the LocalScript into the location of the sound. For example, if the LocalScript is located inside the same folder as the sounds, put script.Parent.Sound. I assume your sounds are in a folder inside PlayerGUI.
Insert also a RemoteEvent into ReplicatedStorage
Okido. So i've made a normal script inside the brick with Script 1 in it. The second is placed as an LocalScript inside the Gui. And i've made a RemoteEvent in the ReplicatedStorage. That's correct right?
So, i've tried what you said. But i get the Error "OnClientEvent is not a valid member of RemoteFunction" from the localscript inside the Gui :O
(There's also a RemoteEvent in ReplicatedStorage
Make sure it's a RemoteEvent not a RemoteFunction. I retested everything and it works fine. You got the error because you renamed a RemoteFunction into RemoteEvent, but it is still a RemoteFunction.