|
| 02 Dec 2012 09:03 PM |
Say I have this:
Workspace +Control ++Script +Model1 ++Brick ++Script +Model2 ++Brick ++Script
The scripts in the Model allow me to change its color to a random color when I touch it. Now, I have a script in another brick called "Control" which lets me switch the two Brick's Parents to the other Brick's. But after I do this, the script in Model1 will control the brick in Model2 and vice versa. How would I make it so that the script controls the brick inside the Model even after I switch it? |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:08 PM |
Edit the script, and put it in the brick?
Alternately, you could copy and clone the script in the other model. |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:10 PM |
| Would I have to clone the script and destroy the original everytime I switch them? Is there an easier way? |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Dec 2012 09:14 PM |
Just do: script.Parent.Brick
I like pineapples. |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:15 PM |
Different example, but this is the connection line.
sp.Item.MouseButton2Click:connect(function() onRightClick(sp.Item) end) sp.Item.DragBegin:connect(function() onBeginDrag(sp.Item) end) sp.Item.DragStopped:connect(function(cx,cy) onStopDrag(cx,cy,sp.Item) end)
|
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:16 PM |
@blueboy
Doesn't work. When used in a connection line, it will follow the brick. |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:16 PM |
game.Workspace.Model1.Script.Parent = game.Workspace.Model2 game.Workspace.Model2.Script.Parent = game.Workspace.Model1 |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:17 PM |
Oh sorry, the control script:
lookslot=ifitem.Parent
ifitem.Parent=ditem.Parent ditem.Parent=lookslot |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2012 09:18 PM |
@ibrillance
I don't think you understand my problem here, I can get it to switch perfectly. However, after they switch, the script in the Model will still target the brick that was originally in the Model before the switch. I want it to target the current brick instead. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|