rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 04:50 AM |
Heres my script:
debounce = false function onTouched() local h=script.Parent:findFirstChild("Humanoid") if h~=nil then debounce = true local parts = game.Workspace.StarterGui.Fence:GetChildren() for i=0, #parts do local c=game.Workspace.StarterGui.Fence:GetChildren() b=c[math.random(1,#c)] local copy=b:Clone() copy.Parent=script.Parent.Parent wait(1) end debounce=false end end
script.Parent.Touched:connect(onTouched)
It should pick randomly a part out of Fence and clone it. But if i touch the button nothing happens. Output doesnt give any error. |
|
|
| Report Abuse |
|
|
itunes89
|
  |
| Joined: 19 Jan 2011 |
| Total Posts: 1957 |
|
|
| 20 Jul 2012 05:07 AM |
Dude make debounce local.
local debounce = false function onTouched(p) local h=p..Parent:findFirstChild("Humanoid") if h~=nil then debounce = true local parts = game.Workspace.StarterGui.Fence:GetChildren() for i=0, #parts do local c=game.Workspace.StarterGui.Fence:GetChildren() b=c[math.random(1,#c)] local copy=b:Clone() copy.Parent=script.Parent.Parent wait(1) end debounce=false end end
|
|
|
| Report Abuse |
|
|
itunes89
|
  |
| Joined: 19 Jan 2011 |
| Total Posts: 1957 |
|
|
| 20 Jul 2012 05:08 AM |
local debounce = false function onTouched(p) local h=p.Parent:findFirstChild("Humanoid") if h~=nil then debounce = true local parts = game.Workspace.StarterGui.Fence:GetChildren() for i=0, #parts do local c=game.Workspace.StarterGui.Fence:GetChildren() b=c[math.random(1,#c)] local copy=b:Clone() copy.Parent=script.Parent.Parent wait(1) end debounce=false end end
Sry added a extra dot. |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 05:37 AM |
| thx man :) but now i got a new problem, parts will be double copied -.- i will whink aboout it myself. |
|
|
| Report Abuse |
|
|
| |
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 05:40 AM |
| Ok, im i right if i say local c is a table ? |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 06:16 AM |
| New Qustion. If i have a Model with 5 Blocks in it. Can i fill them into a Table and also remove them from it? |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
| |
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
| |
|
| |
|
| |
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 10:23 AM |
| But could somebody show me how or give me some information what i should search in the wiki ? |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 10:40 AM |
debounce = false function onTouched(hit) if hit.Parent ~= nil then local h=hit.Parent:findFirstChild("Humanoid") if h~=nil and debounce == false then debounce = true local parts = game.Lighting.Tycoon1.Fence:GetChildren() for i=0, #parts do part=parts[math.random(1,#parts)] local copy=part:Clone() copy.Parent=script.Parent.Parent
table.remove(parts,b) wait(1) end end debounce=false end end
script.Parent.Touched:connect(onTouched)
Guys thats what i have now. But why does it still double clone parts? I mean now it should take b out of the Array parts. but it seems like it doesnt :( |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 10:50 AM |
| And it also can be activated twice -.- |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
|
| 20 Jul 2012 10:51 AM |
| I mean debounce isnt working. somehow. |
|
|
| Report Abuse |
|
|
rastamann
|
  |
| Joined: 27 May 2008 |
| Total Posts: 539 |
|
| |
|