im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 08 Jan 2012 11:51 PM |
function onTouch(part) local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) then print 'lol!' end end
script.Parent.Touched:connect(onTouch)
How would you make this script work only once, so it wouldnt spam the output with lol!lol!lol!lol! Ive seen debounce, is that it? If it is, how do i use it? |
|
|
| Report Abuse |
|
|
|
| 09 Jan 2012 12:06 AM |
if you want it to remove after using:
function onTouch(part) local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) then print 'lol!' script.Parent:Remove() end end
script.Parent.Touched:connect(onTouch)
if you dont want it to remove after using:
node = 0
function onTouch(part) local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) and node == 0 then print 'lol!' node = 1 end end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 09 Jan 2012 12:36 AM |
Replace
script.Parent.Touched:connect(onTouch)
with
x = script.Parent.Touched:connect(onTouch)
then, when you don't want it to work anymore, you can do
x:disconnect() |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 09 Jan 2012 01:11 AM |
| I should have worded it better, i wanted it so it only worked once per player. |
|
|
| Report Abuse |
|
|
GuildsRPG
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 24 |
|
|
| 09 Jan 2012 01:20 AM |
function onTouch(part) local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) and if humanoid.Parent.Value == nil then v = instance.new(Value, humanoid) print 'lol!' end end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 09 Jan 2012 04:00 AM |
| Guilds, your doesnt seem to work :/ |
|
|
| Report Abuse |
|
|