PvN
|
  |
| Joined: 10 Apr 2010 |
| Total Posts: 22145 |
|
|
| 31 Jan 2013 10:46 AM |
script.Parent.Touched:connect(function (hit) if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not script.Parent:FindFirstChild(hit.Parent.Name) then local user = game.Players:GetPlayerFromCharacter(hit.Parent) --M.Text = hit.Parent.Name .. " " M.Name = hit.Parent.Name game:GetService("Debris"):AddItem(M,5) end end)
I don't know how to make it so when you click the brick this stuff happens instead of hitting the brick. My attempts did nothing. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 31 Jan 2013 11:10 AM |
You need a clickDetector, and instead of using the .Touched method/function, use this:
script.Parent.ClickDetector.MouseClick:connect |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 31 Jan 2013 11:11 AM |
| You need a Click Detector inside of script.Parent, and the connection would be script.Parent.Clicked |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 31 Jan 2013 11:12 AM |
| Oh yeh, woops. It be confusing after learning some JavaScript and coming back to Lua. |
|
|
| Report Abuse |
|
|
PvN
|
  |
| Joined: 10 Apr 2010 |
| Total Posts: 22145 |
|
|
| 31 Jan 2013 12:01 PM |
script.Parent.ClickDetector.MouseClick:connect(function (Clicked) if Clicked.Parent and Clicked.Parent:FindFirstChild("Humanoid") and not script.Parent:FindFirstChild(Clicked.Parent.Name) then (also clickdetector in the block)
No errors, but when I click it nothing happens. :\ |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 31 Jan 2013 12:03 PM |
| M isn't defined. I should have read earlier. |
|
|
| Report Abuse |
|
|
PvN
|
  |
| Joined: 10 Apr 2010 |
| Total Posts: 22145 |
|
|
| 31 Jan 2013 12:08 PM |
| I cut a lot of the script out. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 31 Jan 2013 12:10 PM |
| I belive when you do game.Debris:AddItem(instance, timeout) the instance is parented to Debris and the variable is set to nil after timeout. Not sure though, I don't work with Debris often. |
|
|
| Report Abuse |
|
|