How do I weld two anchored parts and tween them?

Hello there everyone!

I was making an ‘Escape the…’ obby and I wanted to add a stage where there are a few stones that come from the ceiling and you have to be quick enough to escape them.

But now my problem is, I have a thin part on the bottom side of the rock that detects if a player has touched it and kills them if so, that part doesn’t move with the actual rock thingy.
I’ve tried welding it but I think TweenService is only for visuals and welds will be ignored.
So I’ve tried tweening that thin parts with the big rock but that, for some reason, also doesn’t work?

Have you got any ideas what I can do?

1 Like

I don’t think the .Touched event works with tweens. Moving the part with a CFrame tween should move it and everything welded to it though, IIRC.

Yeah, I’ve tried this code for tweening:

coroutine.resume(coroutine.create(function()
				while true do
					task.wait(math.random(0.4,0.6))
					local FallTween = TweenService:Create(
						Stone,
						TweenInfo.new(1.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In, 0, false),
						{
							['CFrame'] = CFrame.new(Stone.Position.X, Stone.Position.Y - moveDistance, Stone.Position.Z)
						}
					)
					FallTween:Play()
					FallTween.Completed:Wait()
					task.wait(1)
					local GoUpTween = TweenService:Create(
						Stone,
						TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false),
						{
							['CFrame'] = CFrame.new(Stone.Position.X, Stone.Position.Y + moveDistance, Stone.Position.Z)
						}
					)
					GoUpTween:Play()
					GoUpTween.Completed:Wait()
				end
			end))

But that also doesn’t work

I think if you move something with .Position it doesn’t update the things welded to it.

Yeah but I have done CFrame and not Position

Wait, is your issue .Touched not firing or the welded part not moving?

No, no, no .Touched works fine but the thin part with the .Touched event does not move with the big rock

Huh, can you give me an explorer view of the stone?

Sure, here’s the explorer:

Image

(Smash Part is the thin part and Fall Stone the big rock)

And here are the properties of the weld contraint if you want:

Image

You can try to apply physics using :ApplyImpulse() and changing the collisiongroups so that it only hits character models.

How do I change the collision group that It only hits characters? I only know how to make that they can hit other collision groups.

Try searching the api for the PhysicsService

But should I do It in a coroutine while true do loop?

Rather than applyImpulse, actually you could just anchor the parts and unanchor them when you want to release them from the ceiling. They won’t anything except in its collision group.

No that wouldn’t work because they are stuck in the ceiling and would fly into the stratosphere

Or do you know how I can detect a touch from the bottom side of a part without using a thin part?? :thinking:

The Problem is, You Cant Weld 2 Anchored Parts Together. Try Using WeldContstraints. Or Possibly Make The Parts Unanchored If You can.

I am in fact using weld contraint (see post 9) but If I unanchor these parts they would fall to the ground in a weird position and the tweening would be in a wrong direction

Wait I have an idea…let me try something out

Why Do You Even Need To Weld 2 Anchored Parts. Welds Keep Them In The same Position. It basically makes Them Anchored. And u can Tween It Using The Welds C1.