Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

TouchEnded fires before Touched -- by design?

I am noticing that the TouchEnded event for a Part fires long before the Touched event, even if I've never touched the Part. Is this by design? I'm using a simple script to verify, and walking my character near and away from the Part in question:


script.Parent.Part.Touched:connect(
	function(collidingPart)
		print ("Touch Began for Part, collidingPart is " .. tostring(collidingPart))
	end)


script.Parent.Part.TouchEnded:connect(
	function(collidingPart)
		print ("Touch Ended for Part, collidingPart is ".. tostring(collidingPart))
	end)

Edit: I updated the code to print the colliding part, and I'm getting these parts from my avatar as I move close to the object without touching it. Here is a top-down image of the situation: http://imgur.com/a/LREjd

Touch Ended for Part, collidingPart is RightHand

Touch Ended for Part, collidingPart is RightLowerArm

Touch Ended for Part, collidingPart is RightUpperArm

Touch Ended for Part, collidingPart is LeftHand

Touch Ended for Part, collidingPart is LeftLowerArm

Touch Ended for Part, collidingPart is LeftUpperArm

It appears that these parts (RightHand, LeftHand etc.) are indeed the closest parts to the colliding object, but they're still very far from touching.

2 comments

0

type print(collidingPart) and tell us the results please

0

I've updated the question with this information, thank you very much for your help.

2 answers

✓ Accepted answer

I do not think there is something you can do to fix this. The TouchEnded seems to be very glitchy ;/

I have tried several things to fix it in my own place but it just doesn't appear to be working in any way.

1 comment

0

This is unfortunate, but at least I can write custom code to counter-act the glitchy behavior, since Touched seems a lot more reliable so I can leverage that.

maybe because other parts in thegame

2 comments

0

Possibly. Try printing the part that touched it.

0

I've updated the question with much more information. There are very few parts in the game; I intentionally made a bare-bones setup to eliminate extra parts interfering.

This discussion is preserved as it was. New answers, comments, and votes are closed.