LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
|
| 10 Oct 2016 07:43 PM |
for i,v in pairs(script.Parent:GetChildren()) do if v:IsA("BasePart") then local cd = Instance.new("ClickDetector", v) cd.MouseClick:connect(function() print("beep") local snd = script.Parent.Sound:Clone() snd.Parent = v snd:Play() wait(snd.TimeLength) snd:Destroy() end) end end
Not sure what's wrong. It prints nothing in the output, nor plays any sounds. |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2016 07:46 PM |
would it be cd.MouseClick:connect(function()) not cd.MouseClick:connect(function()
|
|
|
| Report Abuse |
|
|
LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
|
| 10 Oct 2016 07:49 PM |
@Phantom
No, because there's code wrapped inside of the function. |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 10 Oct 2016 07:52 PM |
| Is that your whole script? If so, it could be running so fast that none of script.Parent's children have loaded, which would mean you would be iterating over an empty table. Everything else looks fine though. |
|
|
| Report Abuse |
|
|
LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
|
| 10 Oct 2016 07:54 PM |
@Insta
Yes, it is. I'll try that. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 10 Oct 2016 07:55 PM |
bump because i may have the same issue as the above poster mentioend that i wasn't able to solve
|
|
|
| Report Abuse |
|
|
LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 10 Oct 2016 08:42 PM |
are clickdetectors added to the bricks?
it isn't a localscript right?
|
|
|
| Report Abuse |
|
|
LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
|
| 11 Oct 2016 07:27 AM |
| There are click detectors added to the brick, and is a server script. |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 08:19 AM |
| FilteringEnabled? If I remember correctly you might need a LocalScript to handle the ClickDetector. |
|
|
| Report Abuse |
|
|
LockFocus
|
  |
| Joined: 31 Aug 2013 |
| Total Posts: 1044 |
|
| |
|