Tweens allow player to clip through parts

hey, recently I have tried making a hole in the wall minigame. I have noticed odd behavior when tweening objects. Here is the issue in action: gyazo gif. As you can see, the issue is that it is extremely easy to clip through the walls. This happens whether the wall is a part, union, or mesh. When I make the wall thicker, this happens. At first this looks like a solution, as I did not clip through the wall. However, if you look closely you can see my character shaking against the wall. This shaking causes your character to freeze when they hit the wall, and makes movement impossible. Also not my intended behavior.

I am looking for a way to smoothly move this wall without any sort of physics issues. I believe this can be done with constraints, however I am not experienced in constraints and have 0 clue how to go about this.

You can try moving the wall with CFrame, but not sure how different it would be from tween regarding the physical aspect. I was also thinking you can probably add some velocity to your character to supress the restricting movement shown by the thicker wall.

1 Like

I’ve never used this before, but you can try :ApplyImpulse which will launch the part with a force that you can give as a vector3. The movement will be linear, but I’m not sure if the speed will be consistent. You have much better control with tweens, but :ApplyImpulse shouldn’t give any physics issues.

1 Like

you could make it if the wall is touched the humanoidrootpart of character that touches it gets velocity to the direction its moving by doing

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.HumanoidRootPart.Velocity += Vector3.new(100,0,0)--change the value to the direction its going
	end
end)
1 Like

You need to move the Parts on the Client and have thick walls so Players don’t clip through them.

1 Like

make the walls thicker :_:
and it should work

Wouldn’t apply impulse require it to be unanchored? I’m worried it would just fall over.

moving it on the client seems to make the problem even worse, I just tried it.

this makes it easier to clip through.

it doesn’t if ur velocity is the direction the wall is going it means u will be pushed away from the wall leading u to not clip through it

it is going away from the wall. The problem is that when you start getting pushed away, you go into the wall almost immediately after and so your velocity is negated as you cant move. The velocity causes even more shaking, and makes it easier to clip.


all it does is it makes u ascend but it doesn’t clip me through if that doesn’t resolve a thing just change position by a loop and a cframe being added

is that wall you are testing on being tweened? it looks as if it is not moving.

the wall is moved and it works perfectly fine

btw the wall is 1 stud thick which is around the size shown on video

I am using r6. That could possibly be the problem?

Im giving this post the solution, as I got the idea that fixed the problem from here. In order to solve this, I substituted my tween for a lerp, and added a tiny bit of knockback velocity if you hit it. Here is what my final code looks like, for anyone who has this problem in the future:

local Debounce = false

local function SendWall()
	local Wall = script.Parent.Walls:GetChildren()[math.random(1, 5)]:Clone()
	Wall.Parent = script.Parent
	Wall.CFrame = script.Parent.WallSpawn.CFrame
	Wall.Transparency = 0
	Wall.CanCollide = true
	
	Wall.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") and not Debounce then
			Debounce = not Debounce
			local BodyVelocity = Instance.new("BodyVelocity", hit.Parent.HumanoidRootPart) -- Creates a new BodyVelocity force inside HRP

			BodyVelocity.Velocity = Vector3.new(100,0,0)

			task.wait(0.1)

			BodyVelocity:Destroy()
			wait(0.3)
			Debounce = not Debounce
		end
	end)
	
	for i = 0, 1, 0.01 do
		Wall.CFrame = Stage.WallSpawn.CFrame:Lerp(Stage.WallEnd.CFrame, i)
		wait()
	end
end

possibly cuz ur ussing bodyvelocity which is velocity that decreases unless u change it also if u wanted to use body velocity u forgot to add the max force u can put on it(btw i did some testing and it will clip through walls smaller than a stud thick which the reason might be obvious)