generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Script Builder, Inserting a touch script into a brick

Previous Thread :: Next Thread 
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
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
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
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
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
25 Feb 2009 03:56 PM
nah that dosn't work

dont you have to use Instance.new("Script")?
Report Abuse
Meelo is not online. 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 is not online. 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
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
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 is not online. 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
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
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
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
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
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
26 Feb 2009 03:16 PM
could anyone explain it to me?
Report Abuse
level140roblox is not online. level140roblox
Joined: 08 Jun 2008
Total Posts: 9577
26 Feb 2009 03:21 PM
meelo, having a little trouble with your ontouched scripts >:)
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
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
level140roblox is not online. level140roblox
Joined: 08 Jun 2008
Total Posts: 9577
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
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
26 Feb 2009 03:49 PM
Ha, I generally don't think of them at all. I hate script builder.
Report Abuse
teseting is not online. 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
MusicCookies is not online. MusicCookies
Joined: 01 Feb 2009
Total Posts: 31
27 Feb 2009 09:35 AM
ah i see, thanks very much guys
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image