Clearest
|
  |
| Joined: 19 Jun 2011 |
| Total Posts: 1166 |
|
|
| 22 Dec 2013 08:18 PM |
I am trying to use this script, but I would like it to be disabled after the button is hit for 10 seconds rather than the color just changing. Can you guys help? Here's the script.
local box = script.Parent
local debounce = false
local everything = {model} local names = {model}
local children = game.Workspace:children() for i=1,#children do if (children[i].Name == "waterboat") then -- Replace your model here with the name of your model (the name that appears in the explorer) table.insert(everything, children[i]:clone()) table.insert(names, children[i].Name) end end
function regen() for i=1,#everything do game.Workspace:findFirstChild(names[i]):remove() new_thing = everything[i]:clone() new_thing.Parent = game.Workspace new_thing:makeJoints() end end
function onTouched() script.Parent.BrickColor = BrickColor.new(26)
regen() wait(10)
script.Parent.BrickColor = BrickColor.new(104)
debounce = false end
script.Parent.ClickDetector.MouseClick:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 22 Dec 2013 08:22 PM |
local box = script.Parent local debounce = false local everything = {model} local names = {model} local children = game.Workspace:children()
for i=1,#children do if (children[i].Name == "waterboat") then -- Replace your model here with the name of your model (the name that appears in the explorer) table.insert(everything, children[i]:clone()) table.insert(names, children[i].Name) end end
db = false function regen() if db = false then db = true for i=1,#everything do game.Workspace:findFirstChild(names[i]):remove() new_thing = everything[i]:clone() new_thing.Parent = game.Workspace new_thing:makeJoints() wait(10) db = false end end end
function onTouched() script.Parent.BrickColor = BrickColor.new(26)
regen() wait(10)
script.Parent.BrickColor = BrickColor.new(104)
debounce = false end
script.Parent.ClickDetector.MouseClick:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 22 Dec 2013 08:23 PM |
| ^Dont know if that'll be in sync with the color changing... |
|
|
| Report Abuse |
|
|
Clearest
|
  |
| Joined: 19 Jun 2011 |
| Total Posts: 1166 |
|
|
| 22 Dec 2013 10:48 PM |
| I can't get it to work at all using the script you provided. Studio shows a error on the line "if db = false then". Thank you for trying to help me. |
|
|
| Report Abuse |
|
|
|
| 22 Dec 2013 10:59 PM |
local box = script.Parent local debounce = false local everything = {model} local names = {model} local children = game.Workspace:children()
for i=1,#children do if (children[i].Name == "waterboat") then -- Replace your model here with the name of your model (the name that appears in the explorer) table.insert(everything, children[i]:clone()) table.insert(names, children[i].Name) end end
db = false function regen() if db == false then db = true for i=1,#everything do game.Workspace:findFirstChild(names[i]):remove() new_thing = everything[i]:clone() new_thing.Parent = game.Workspace new_thing:makeJoints() wait(10) db = false end end end
function onTouched() script.Parent.BrickColor = BrickColor.new(26)
regen() wait(10)
script.Parent.BrickColor = BrickColor.new(104)
debounce = false end
script.Parent.ClickDetector.MouseClick:connect(onTouched)
--sorry, i forgot about the other equal, this should work now? |
|
|
| Report Abuse |
|
|
Clearest
|
  |
| Joined: 19 Jun 2011 |
| Total Posts: 1166 |
|
| |
|
| |
|