|
| 25 Feb 2009 03:15 PM |
Say i wanted to use this script in script builder
brick = game.Workspace.brick
function onTouch(part) wait(1) brick.Transparency = 1 brick.CanCollide = nil wait(5) brick.Transparency = 0 brick.CanCollide = 1 end brick.Touched:connect(onTouch)
how would i link that to a specific brick? is it similar to asigning a brick parent like
b = Instance.new("Part") b.Parent = Workspace
thanks for any replies |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2009 03:35 PM |
b = Instance.new("Part") b.Parent = workspace b.Position=Vector3.new(0,5,0) b.Anchored=true b.Locked=false script.Parent=b
brick = script.Parent function onTouched(hit) wait(1) brick.Transparency = 1 brick.CanCollide = nil wait(5) brick.Transparency = 0 brick.CanCollide = 1 end brick.Touched:connect(onTouched)
I suppose this would work.... |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2009 03:56 PM |
nah that dosn't work
dont you have to use Instance.new("Script")? |
|
|
| Report Abuse |
|
|
Meelo
|
  |
| Joined: 04 Jul 2008 |
| Total Posts: 14763 |
|
|
| 25 Feb 2009 03:58 PM |
b = Instance.new("Part") b.Parent = workspace b.Position=Vector3.new(0,5,0) b.Anchored=true b.Locked=false
function onTouched(hit) wait(1) brick.Transparency = 1 brick.CanCollide = nil wait(5) brick.Transparency = 0 brick.CanCollide = 1 end b.Touched:connect(onTouched)
I'm sure Anaminus is watching right now, and, to spare him his post, it's inefficient to add a new script. |
|
|
| Report Abuse |
|
|
Meelo
|
  |
| Joined: 04 Jul 2008 |
| Total Posts: 14763 |
|
|
| 25 Feb 2009 03:58 PM |
Oh whoops:
b = Instance.new("Part") b.Parent = workspace b.Position=Vector3.new(0,5,0) b.Anchored=true b.Locked=false
function onTouched(hit) wait(1) b.Transparency = 1 b.CanCollide = nil wait(5) b.Transparency = 0 b.CanCollide = 1 end b.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 25 Feb 2009 03:59 PM |
No, i am not making a new script to put the code in, I am just using the same code.
But you have to change this:
brick.Transparency = 1 brick.CanCollide = nil wait(5) brick.Transparency = 0 brick.CanCollide = 1
to this:
brick.Transparency = 1 brick.CanCollide = false wait(5) brick.Transparency = 0 brick.CanCollide = true |
|
|
| Report Abuse |
|
|
Meelo
|
  |
| Joined: 04 Jul 2008 |
| Total Posts: 14763 |
|
|
| 25 Feb 2009 04:01 PM |
Gah, missed that one too (My brain's fried from standerdized testing) = Instance.new("Part") b.Parent = workspace b.Position=Vector3.new(0,5,0) b.Anchored=true b.Locked=false
function onTouched(hit) wait(1) b.Transparency = 1 b.CanCollide = false wait(5) b.Transparency = 0 b.CanCollide = true end b.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 01:19 AM |
hmmm ok, havn't had time to try that yet but will do soon, i just dont get how the script is linked to the part you just created, to me it looks like you just create a brick then state a script.
and also "nil" and "1" works just as good as true or false
thanks for the help guys |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 12:24 PM |
| cool yeah that works, but i still dont get how the script knows what needs to be hit for the script to run. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 03:16 PM |
| could anyone explain it to me? |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 03:21 PM |
| meelo, having a little trouble with your ontouched scripts >:) |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 03:34 PM |
Okay, the script knows what touches the brick because of the last line. The one that says "brick.Touched:connect(onTouched)" brick in this case is the part that was created in the beginning of the script. And this line will also connect it back to the function that was created.
It is hard to imagine script builder scripts as scripts, but more like commands. You just have to think as if you are placing that script in a brick in studio. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 03:36 PM |
| I think of them as normal logical scripts, put together in the same way as normal scripts. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2009 03:49 PM |
| Ha, I generally don't think of them at all. I hate script builder. |
|
|
| Report Abuse |
|
|
teseting
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 2535 |
|
|
| 26 Feb 2009 04:50 PM |
b = Instance.new("Part") b.Parent = workspace b.Position = Vector3.new(0,5,0) b.Anchored = true b.Locked = false
function onTouched(hit) wait(1) b.Transparency = 1 b.CanCollide = false wait(5) b.Transparency = 0 b.CanCollide = true end b.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2009 09:35 AM |
| ah i see, thanks very much guys |
|
|
| Report Abuse |
|
|