biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 02 Nov 2011 04:02 PM |
[Beginer Scripter]
How do I use it because I am learning how to and I am trying to touch a brick and make it change every color in the colorpad but I don't know how to use the onTouch function.
|
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
| |
|
TheWisest
|
  |
| Joined: 11 Nov 2010 |
| Total Posts: 7345 |
|
|
| 02 Nov 2011 04:05 PM |
Simple:
function onTouched(hit) --Calls the function, you can name it anything though. E.G 'onBanana(hit)' -Stuff Stuff end script.Parent.Touched:connect(onTouched) --Executes the function. |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2011 04:07 PM |
Like TheWisest said, that is how you use it, but if you change the name of the function you also have to change the
script.Parent.Touched:connect(onTouched) --You have to change "onTouched" to your function name. |
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
| |
|
TheWisest
|
  |
| Joined: 11 Nov 2010 |
| Total Posts: 7345 |
|
|
| 02 Nov 2011 04:08 PM |
@Willing,
I was just about to mention that. :P |
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 02 Nov 2011 04:09 PM |
| So I just write the script where it says -stuff stuff |
|
|
| Report Abuse |
|
|
TheWisest
|
  |
| Joined: 11 Nov 2010 |
| Total Posts: 7345 |
|
|
| 02 Nov 2011 04:13 PM |
| Yeah pretty much...... if you have any more errors, don't be afraid to ask. :) |
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 03 Nov 2011 11:19 AM |
Would this work?
function onTouched("Wedge")
wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Bright Yellow")
wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Black")
wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Red")
end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
TheWisest
|
  |
| Joined: 11 Nov 2010 |
| Total Posts: 7345 |
|
|
| 03 Nov 2011 12:43 PM |
Eh, no.....
When you call the function, there really is no need to put the object in that line.
So it should just be:
function onTouched(hit) wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Bright Yellow") wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Black") wait(1) game.Workspace.Wedge.BrickColor = BrickColor.new("Red") end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 03 Nov 2011 01:53 PM |
@Above
I love beginner scripters :D |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2011 02:05 PM |
Another way is:
-- this is in a brick! :D
part = workspace.Base
script.Parent.Touched:connect(function(hit,part) hit:Remove() part:Remove() end
|
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 03 Nov 2011 05:07 PM |
Ok I tryed it and the Output said this (Touched is not a valid member of Workspace)
|
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 03 Nov 2011 05:14 PM |
| I fixed it forgot to put the script into the Wedge part. :) Stupid mistake. |
|
|
| Report Abuse |
|
|
biker6700
|
  |
| Joined: 22 Mar 2010 |
| Total Posts: 1515 |
|
|
| 04 Nov 2011 06:21 PM |
[Beginner Scripter]
Would this work in a part?
--Made by Biker6700
Explode = Instance.new("Explosion")
function onTouched(hit) Explode = Instance.new("Explosion") Explode.BlastRadius = 12 Explode.BlastPressure = 1000 Explode.Position = script.Parent.Position Explode.Parent = game.Workspace script.Parent.Transparency = 0 connection:disconnect() end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 04 Nov 2011 06:23 PM |
game.Workspace.Part.onTouch:connect (function)) print("ow") end)
put the name of the brick were Part is in the script. then put function and then put what you want then end) |
|
|
| Report Abuse |
|
|
GigsD4X
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 3794 |
|
|
| 04 Nov 2011 06:28 PM |
^ Actually that should be game.Workspace.Part.Touched:connect(function() print("ow") end)
^^ Yes it would. |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 04 Nov 2011 06:54 PM |
| I see that your improving very quick :D |
|
|
| Report Abuse |
|
|