Finds any descendent of an instance.
That can’t be the case, you can inspect my part model here:
This isn’t true. Anchored turns on and off physics. Touched is physics.
If two parts without physics are moved into each other, no touch event fires because neither are running physics for their collisions.
two anchored parts will never fire the BasePart.Touched event on each other
I think you misunderstand, I mean anchored. Anchored matters. Like I said originally and am saying for the third time.
ok, cantouch.
At this point, just please use and inspect my part model I had given to you so we can all call it a day and go home quick.
This code is wrong, hit
is the base part and shouldn’t have the “Active” instance as a child or descendant.
The code should be what it was originally:
hit.Parent.Parent == workspace.Plates.Active
or possibly
hit:IsDescendantOf(workspace.Plates.Active)
Yeah, doesn’t work. I changed the if statement too, and it just doesn’t run at all
Yeah, this doesn’t help with their code. I tried it
Resort to this then.
So use GetTouchingParts? most of that code uses mouse stuff.
You can convert the event. There is a tedious solution too.
Weld an unanchored part to the part that is touching workspace.Plates then put the .Touched event to the welded part.
Do I use a Weld or WeldConstraint?
WeldConstraint
Okay, that’s what I thought. Making sure
Here is the code to solve this. Using physics is the easiest way and it will be automatically interpolated on the client so it’s smoother.
local part = newDrop
part.Anchored = false
part.CanTouch = true
local attachment = Instance.new("Attachment")
attachment.Parent = part
local velocity = Instance.new("LinearVelocity")
velocity.MaxForce = math.huge
velocity.VectorVelocity = Vector3.new(0, -0.1/0.03, 0)
velocity.Attachment0 = attachment
velocity.Parent = part
part.Touched:Connect(function(hit)
print("Hit "..hit.Name)
if hit.Parent.Parent == workspace.Plates.Active then
print("Hit ground "..part.Name)
velocity:Destroy()
attachment:Destroy()
end
end)
You probably messed up setting up the constraint, so I made the code do that for you.
I’m not sure why, but even after welding the part it didn’t actually weld if that makes sense
OMG finally, thank you so much
One question: Is there a specific reason to use “-0.1/0.03” over just -3.33?
No I’m just lazy
(I wanted it to be the same number as your current code, didn’t want to do the math, and because of how lua calculates those numbers it doesn’t affect performance.)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.