Hi There!
I want to play a sound that only the player who touched a Part can hear.
When a player touches a part, the sound plays for every player on the server instead of playing for that one player who touched the Part
This is the local script
workspace.Part.Touched:Connect(function()
game.SoundService.Sound:Play()
end)
I’ve tried putting the Sound and LocalScript in PlayerGui, in the player’s character, in the workspace
I’ve tried PlayLocalSound() function but nothing worked
local SoundService = game:GetService("SoundService")
local function playLocalSound(soundId)
local sound = Instance.new("Sound")
sound.SoundId = soundId
SoundService:PlayLocalSound(sound)
sound.Ended:Wait()
sound:Destroy()
end
workspace.Part.Touched:Connect(function()
playLocalSound("rbxassetid://1837461008")
end)