Try this then.
local __ONGROUND = false
coroutine.wrap(function()
repeat
task.wait()
newDrop.Position -= Vector3.new(0, 0.1, 0)
until __ONGROUND == true
end)()
newDrop.Touched:Connect(function(hit)
if hit:FindFirstChild("Active", true) then
print("HIT IF STATEMNT")
__ONGROUND = true
end
end)
What does the true inside of FindFirstChild mean?
Finds any descendent of an instance.
That can’t be the case, you can inspect my part model here:
BendsSpace
(BendsSpace)
January 31, 2023, 1:40am
#55
weakroblox35:
This is a long a thread for no reason and I’m gonna clear some misconceptions.
Parts properties do not matter here!
Expect for CanTouch, which is responsible for .Touched and similar events.
The snippet I posted works when it touches but the if statement does not pass! Something is wrong with it. What is workspace.Plates.Active
? And where is it located?
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
(the documentation )
weakroblox35:
ok, cantouch.
I think you misunderstand, I mean anchored. Anchored matters. Like I said originally and am saying for the third time.
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.
1 Like
BendsSpace
(BendsSpace)
January 31, 2023, 1:45am
#58
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
1 Like
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?
Okay, that’s what I thought. Making sure
BendsSpace
(BendsSpace)
January 31, 2023, 2:03am
#67
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.
2 Likes
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
1 Like
One question: Is there a specific reason to use “-0.1/0.03” over just -3.33?
1 Like