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

Is there a touched event for parts that are Anchored and CFramed?

Touched events do not work for parts that are CFramed and anchored, as stated in the the wiki. This event does not fire if the part is being CFramed through something. (This is an excerpt from the wiki). My real problem is I have many parts flying around using BodyForces, and this creates a lot of physics lag. Unanchoring the 'bullet' makes the event fire, but glitches out the bullet itself. I have thought about using RenderStepped:wait()(something like that) so that each frame it isn't glitching out, but this would create the same amount of lag I had to start with. Is there any other way to have an event that acts just like a Touched event would?

--Here's part of the script.
lazer = script.Parent	
lazer.Touched:connect(function(otherPart)

end)

1 comment

0

Updated my post with code and a link to the appropriate part on the Wiki

1 answer

✓ Accepted answer

No, but there are solutions
You can check if it is intersecting with another part's physical boundaries after the CFrame. Use GetTouchingParts for this.

-- Following a CFrame operation
for k,v in pairs(movedPart:GetTouchingParts()) do
	-- v is now any part it touched, effectively.
end

I hope this helped. If you have any implementation issues, feel free to ask for help.

4 comments

0

Thanks! I am still interested in your solution. For now, I am unanchoring the part and CFraming it every frame, which enables me to use the touched event. I plan on comparing each of the options I have to see which one runs with the least amount of lag.

0

YUSSSSSS thxxxxxx I did research for almost 3 hours and couldn't find that. THANK YOUUUUU NOW BACK TO SCRIPTING

0

I also have to add that you've only had one question, and you ended up answering it yourself. Lol

0

I'm good at answering things. I'm a solutions person.

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