I made a little code... But It doesn't work
1 | workspace.Level 1. Platform.Touched:Connect( function (Hit) |
2 | local Player = script.Parent.Parent.Parent.Parent.Name |
3 | if Hit.name = = Player.Name then |
4 | script.Parent.Playing = true |
5 | end |
6 | end ) |
Please tell me what to do!....
This is quite simple in fact.
If this is a server script:
Fire a remote to the player you want to hear the sound (See FireClient, RemoteEvents). This could also work with RemoteFunctions (See InvokeClient, RemoteFunctions).
Obtain the sound, place it wherever you want in the localscript and then proceed to play it. This will make only that one player hear it.
If this is already a local script, playing it will be sufficient.
Well, I found a solution on YouTube! This is by AlvinBlox
1 | SelectTheObject.Touched:Connect( function (Hit) |
2 | if Hit.Parent:FindFirstChild( 'Humanoid' ) then |
3 | game.Players [ Hit.Parent.Name ] .PlayerGui.Sound:Play() |
4 | game.Players [ Hit.Parent.Name ] .PlayerGui.Sounds:Stop() |
5 | end |
6 | end ) |
But Thank you!