Information:
Script:
local finishPart = game.Workspace.Levels.Level1.Checkpoints:WaitForChild("Finish") function onTouch (hit) local H = hit.Parent : FindFirstChild("Humanoid") local S = game.Players.LocalPlayer.PlayerGui.Ding if H ~= nil then S:Play() end end finishPart.Touched:connect(onTouch)
ok so i have an answer for why it would play for all players, so each player has that script running for them, meaning that when one person touches the part every other script sees that someone touched that part and plays the sound, you need to tell it to only play the sound if YOU touch it, not anyone else
local finishPart = game.Workspace.Levels.Level1.Checkpoints:WaitForChild("Finish") local plr = game.Players.LocalPlayer local char = plr.Character repeat char = plr.Character until char ~= nil -- the reason why i do this is because the player's character might not be loaded in yet so it repeats this until it is loaded in function onTouch (hit) local H = hit.Parent : FindFirstChild("Humanoid") local S = game.Players.LocalPlayer.PlayerGui.Ding if H ~= nil and game.Players.LocalPlayer.Character.Humanoid == H then S:Play() end end finishPart.Touched:connect(onTouch)
this will make it so it checks to see that the person who touched it, is the character
local finishPart = game.Workspace.Levels.Level1.Checkpoints:WaitForChild("Finish") local plr = game.Players.LocalPlayer local char = plr.Character repeat char = plr.Character until char ~= nil finishPart.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") and hit.Parent == char then game.Players.LocalPlayer.PlayerGui.Ding:Play() end end)
^this is the way i would do it, they both should work the same way though tell me if there are any questions or this doesn't work
hope this helps!
Try to change this:
local S = -- locate the sound inside the startergui.
When there is something inside the startergui, it only replicated for that specific user. So placing the sound inside the startergui will make the sound play only for the player who touched the brick. Make sure you are referencing the sound correctly inside the local script.
local SP = workspace:WaitForChild("What is the part name you put it here") function onTouch (hit) local H = hit.Parent : FindFirstChild("Humanoid") local S = game.Players.LocalPlayer.PlayerGui.Ding if H then S:Play() end end SP.Touched:connect(onTouch)
if that doesn't work tell me