.Touched() Event not working on anchored parts

I made a code for a black hole in which it detects any objects that are touched to it and pulles them to the middle.
I found out that the .Touched event doesn’t work on anchored parts.
And many of the parts that i want to pull are anchored.
I have absolutely no idea how to get the part.

I request you to please help me.
thank you :slight_smile:

4 Likes

Can you provide the code you have so far?

1 Like

You could use Tween service and then use .magnitude I belive to find what is close to the brick. I’m not sure if it’ll work.

2 Likes

I suggest adding a line of code to your script where it sets the anchored property of the part to false before pulling them to the middle.

BlackHole.Touched:Connect(function(part)
   part.Anchored = false
   -- Insert your pull script here
end)
3 Likes

I cant. Its took me very long to make that code and i dont want to just display it.
All i can say is that it first has the .Touched event at the start of it

I used lerp and all i want to find is the part which touches the blackhole

It wont work because the .Touched event wont get fired.
I tried ir several times.

If you’re not going to provide a sample of your code there is no way that we can help you.

1 Like
eater = script.Parent
eater.Touched:connect(function()
    if humanoid then
    ---     lerp to black hole
    elseif part then
    --- lerp to black hole
    --- check if anchored and anchor

    end
end)

All i need to find is how i can find touched anchored parts

Touched event’s don’t work if both are anchored parts since they aren’t physically simulated. There’s a trick that works.

part.Touched:Connect(function() 

for _, part in ipairs(part:GetTouchingParts()) do
      if part.Name == "" then
              --> code
      end
end 
end)
6 Likes

Ill try it out. Thank you soo much.
So does this run in a continuous loop?
Heart this if yes.
Thanks.

1 Like

Touched events do work on anchored parts, this is not the solution to the OP’s problem.

You must be doing something wrong if your touched event is not working properly, and in order to figure this out, you’d need to provide some code for anyone to help you.

Edit: Touched events work between any anchored part and at least 1 unanchored part, not two anchored parts. I assumed this was involving at least 1 unanchored part because more often than not, 2 anchored parts would not be moving.

If you insist on using 2 anchored parts, at this point, you may as well be using Raycasts, but that solution would be a lot more complex than using unanchored parts and touched events.

It works but theres a problem. It only starts after i touch it.

THEY dont. I researched it. See it for yourself.

Touched event’s do work but both should not be anchored one can be anchored and one should not be, this is the solution to OP’s problem.

1 Like

Any idea?

Yes, and that’s how it works unfortunately.

1 Like

Thank you soo much. U have no idea how much you helped me.

Sorry, this is entirely false my guy. :slight_smile:

You see, they do work whenever anchored or not, it depends on the physics and motions it has on Roblox Studio and the Engine itself. @TheFurryFish is right here and your solution makes it harder and not the quick answer to the OP, unfortunately, also be nice next time.

Here is a quick demo on an un-anchored and an anchored part:

I don’t have the true answer, but there shouldn’t be any code whatsoever as physics does it stuff whether unanchored and anchored.

3 Likes

The overall reason why i wanted the answer was because i wanted a part to register and anchored’s part. In the video YOU touched the part. Thats not what i want.
And sorry if we seemed harsh.