|
| 31 May 2012 04:32 PM |
Why doesn't this script work? It is supposed to regen the brick that it is in and the other script in the brick. It is supposed to wait 10 secs after it is touched, then regen... but instead nothing happens.
model = script.Parent
backup = model:clone()
function onTouched(hit) wait(10)
model = backup:clone() model.Parent = game.Workspace model:makeJoints()
end
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 31 May 2012 04:33 PM |
You never had a connection line.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 31 May 2012 04:39 PM |
| sorry I'm not the best at scripting.... I'm kinda new to it. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 31 May 2012 04:39 PM |
Last line
script.Parent.Touched:connect(function_name_here)
And also, change the script.Parent to what you want to be touched. |
|
|
| Report Abuse |
|
|
|
| 31 May 2012 04:45 PM |
So would it be like this?
model = script.Parent
backup = model:clone()
function onTouched(hit) wait(10)
model = backup:clone() model.Parent = game.Workspace model:makeJoints()
script.Parent.Touched:connect(onTouched)
end
and why wouldn't script.Parent work if brick that I want to regen is the Parent of this script? |
|
|
| Report Abuse |
|
|
|
| 31 May 2012 04:47 PM |
A connection line goes AFTER the function. Not inside.
model = script.Parent backup = model:clone() function onTouched(hit) wait(10) model = backup:clone() model.Parent = game.Workspace model:makeJoints() end script.Parent.Touched:connect(onTouched)
MrMcAero |
|
|
| Report Abuse |
|
|
|
| 31 May 2012 04:49 PM |
| so if I do that, would the script work even with model = script.Parent |
|
|
| Report Abuse |
|
|