of     1   

skyarex
#126288412Thursday, February 20, 2014 9:21 PM GMT

How can you make a touch event work between two objects? I don't mean between a humanoid and brick, I mean between two bricks. I have been struggling to make it work. "Don't Panic"- HHGTTG
ayub32
#126288596Thursday, February 20, 2014 9:23 PM GMT

script.Parent.Touched:connect(function(hit) if hit.Parent:IsA("Part") then --stuff end end)
skyarex
#126288921Thursday, February 20, 2014 9:27 PM GMT

@Ay That only works if it isn't touching anything I think. However the brick I have is touching the ground. How would this work? "Don't Panic"- HHGTTG
islandmaker2012
#126289403Thursday, February 20, 2014 9:32 PM GMT

script.Parent.Touched:connect(function(thing) print (script.Parent.Name.." and "..thing.Name.." have touched") end) So if this was in:Part1 And it hit:Part2 Ouput would be: -Part1 and Part2 have touched
skyarex
#126289489Thursday, February 20, 2014 9:33 PM GMT

@Ay It doesn't work. "Don't Panic"- HHGTTG
MarioKartAddict
#126289687Thursday, February 20, 2014 9:35 PM GMT

name the part you want to check "BlockToCheck" script.Parent.Touched:connect(function(hit) if hit:IsA("Part") and hit.Name == "BlockToCheck" then --stuff end end)
skyarex
#126289694Thursday, February 20, 2014 9:35 PM GMT

@island Nothing is happening. "Don't Panic"- HHGTTG
islandmaker2012
#126289902Thursday, February 20, 2014 9:37 PM GMT

Once it actually"touches" it'll do ittry inserting that script into a part,then put a part a few studs above it,and hit play..
islandmaker2012
#126290050Thursday, February 20, 2014 9:38 PM GMT

Of course its not gonna run if the part is sitting on the baseplate,and u expect it to say part touched baseplate..and BTW,ever hear of output?
skyarex
#126290245Thursday, February 20, 2014 9:41 PM GMT

@mario Nothing happened. "Don't Panic"- HHGTTG
MarioKartAddict
#126290397Thursday, February 20, 2014 9:42 PM GMT

Did you replace "--stuff" with some code?
skyarex
#126290432Thursday, February 20, 2014 9:43 PM GMT

>Once it actually"touches" it'll do ittry inserting that script into a part,then put a part a few studs above it,and hit play.. What? >Of course its not gonna run if the part is sitting on the baseplate,and u expect it to say part touched baseplate..and BTW,ever hear of output? Well, considering i am using the print function in order to tell if the script works...in fact forget it. I am not even going to justify that stupidity with an answer. "Don't Panic"- HHGTTG
Bokken
#126290603Thursday, February 20, 2014 9:44 PM GMT

Are you talking about detecting collisions that have already occurred? As in, the blocks are already touching prior to the script being ran?
skyarex
#126290942Thursday, February 20, 2014 9:48 PM GMT

>Are you talking about detecting collisions that have already occurred? As in, the blocks are already touching prior to the script being ran? Yes, basically. "Don't Panic"- HHGTTG
7y13rb
#126291529Thursday, February 20, 2014 9:54 PM GMT

function onTouched(otherPart) if otherPart.Name ~= "Baseplate" then --stuff end end script.Parent.Touched:connect(onTouched) --something like this, i think...
Bokken
#126292076Thursday, February 20, 2014 9:59 PM GMT

Assuming they're connected by some surface connection you can use the following, pastebin.com/vZGGgATP otherwise you'll have to create an algorithm to detect the intersection of arbitrary oriented shapes, which could be fairly difficult.
islandmaker2012
#126292431Thursday, February 20, 2014 10:02 PM GMT

Ok,so here's an idea then..wow,plz next time,be more specific,it seemed like u were asking for an ontouch function to me.. part = script.Parent touching=false while not touching do wait(0.1) for I,v in pairs (Workspace:GetChildren()) do if v.Name ~= script.Parent.Name and v:IsA("Part") then if v.Position.Y-script.Parent.Position.Y-1 then print "close togther" end end end Something like this maybe?
Bokken
#126293994Thursday, February 20, 2014 10:17 PM GMT

Was the issue resolved with my example script? If not I can help you further.
skyarex
#126294409Thursday, February 20, 2014 10:22 PM GMT

@Brokken Yeah, I put it in the part and nothing happened. Nothing showed up on the output :( "Don't Panic"- HHGTTG
Bokken
#126294626Thursday, February 20, 2014 10:24 PM GMT

Can you describe the context of the situation a little more? Are the parts connected by a surface joint, are they arbitrarily orientated in space and you'd just like to know whether they're colliding/touching or are they axis aligned?
Drybones3363
#126297416Thursday, February 20, 2014 10:50 PM GMT

add a fire or something that isnt in most objects and ontouch check if it has that object

    of     1