|
| 13 May 2014 01:49 PM |
| ive tried looking it up on the internet and ive tried writing it mysel but i cant figure it out how to do it, how do i make it so when you click on a block it plays a sound? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:33 PM |
| do u want exactly a Click Brick or will an onTouch Brick do while I make 1 with ClickDetector? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:49 PM |
1. Insert a ClickDetector into the brick 2. Insert your sound into your brick 3. Insert a script into the brick 4. Put this inside the script;
local debounce = false
script.Parent.MouseClick:connect(function() debounce = true script.Parent.Sound:Play() --change Sound to the name of your sound debounce = false end |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:53 PM |
| u dont need a debounce for ClickDetectors... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 14 May 2014 03:46 AM |
| it didnt work any other ideas? |
|
|
| Report Abuse |
|
|
nacker
|
  |
| Joined: 06 Oct 2009 |
| Total Posts: 6034 |
|
|
| 14 May 2014 06:36 AM |
local debounce = true
function clicked () if debounce == true then debounce = false script.Parent.Sound:Play() wait(0.3) debounce = true end end
script.Parent.MouseClick:connect(clicked) |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 09:49 AM |
| @Knacker sorry, just saw I messed up debounce. |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 11:31 AM |
| it keeps saying "connect is not a valid member of clickdetector" am i missing something? |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 11:34 AM |
| script.Parent.ClickDetector.MouseClick:connect |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 14 May 2014 11:39 AM |
| Optional: Preload the song first so the sound will finish loading before playing |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 11:39 AM |
@mega script.Parent.ClickDetector.MouseClick:connect(functioname)
put the script into the brick |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
|
| 14 May 2014 11:41 AM |
local debounce = false
script.Parent.ClickDetector.MouseClick:connect(function() if not debounce then debounce = true script.Parent.Sound:Play() --change Sound to the name of your sound debounce = false end end |
|
|
| Report Abuse |
|
|
Azeroth17
|
  |
| Joined: 13 May 2014 |
| Total Posts: 86 |
|
|
| 14 May 2014 11:42 AM |
Accidentally deleted the bracket somehow.
local debounce = false
script.Parent.ClickDetector.MouseClick:connect(function() if not debounce then debounce = true script.Parent.Sound:Play() --change Sound to the name of your sound debounce = false end end) |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 11:42 AM |
so it should look like this
Part -Script -ClickDetector -Sound |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 03:06 PM |
ITS WORKED!!
Thank you everyone :D |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 May 2014 03:09 PM |
They can still spam the clicks because debounce turns off right after playing the sound
JigglingJack -- Starting At $21,545 [ Locate a dealer now ] [ Bid now ] [ Buy now ] |
|
|
| Report Abuse |
|
|