Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Different sound plays when somebody else touches a brick with sound script?

Sorry if the title doesn't make sense, but how do I change it so that when the player touches a brick it plays sound without others interrupting? Like when guy A touches a brick that has this script, it plays a sound, but when guy B touches another brick that also has this script with a different sound, the sound for guy A changes too to that sound. How can I fix that? Sorry if this sounds like a piece of cake.

guy A's touched brick:

 local debounce = false
 script.Parent.Touched:Connect(function()
 if not debounce then
 debounce = true
 		workspace.SoundA:Play()
 end
 end)

guy B's touched brick:

local debounce = false
script.Parent.Touched:Connect(function()
if not debounce then
debounce = true
		workspace.SoundA:Stop()
		workspace.SoundB: Play()
end
end)

I want it so that the player only gets to hear the sound when they only touch the bricks themselves.

1 comment

0

l o c a l s c r i p t

1 answer

✓ Accepted answer

Do you want players to hear other players their sound or do you just want the player that touched the brick to hear that sound. If it's the latter then use a localscript

btw you might wanna add a wait for your debounce

sound.Ended:Wait()

1 comment

0

thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.