Part pushing other parts off if anchored while moving

Hello fellow developers! I made a trash bin, which you can push. The system works by adding a Motor6D which connects the trash bin to the player’s character and replacing the default idle and walk animations. Then when the player “stops pushing” the Motor6D is destroyed and the animations are set back to default. I accidentally noticed that if I “stopped pushing” the trash bin while I wasn’t standing still and I jumped on top of it I would get pushed off.

  1. What do you want to achieve?
    The trash bin not to push players or other parts off.
  2. What is the issue? Include screenshots / videos if possible!
    Video
  3. What solutions have you tried so far?
    I’ve tried looking for solutions all over the internet, but couldn’t manage to find any.

Here is the function that is responsible for letting go of the trash bin.

function onRelease(player)
	if isPushed.Value == true and cooldown == false then
		cooldown = true
		local character = player.Character
		local humanoid = character:WaitForChild("Humanoid")
		local animateScript = character:WaitForChild("Animate")
		animateScript.walk.WalkAnim.AnimationId = defaultAnim3
		animateScript.idle.Animation1.AnimationId = defaultAnim1
		animateScript.idle.Animation2.AnimationId = defaultAnim2
		for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
			playingTracks:Stop(0)
		end
		firstMagnitude = humanoid.MoveDirection.Magnitude
		if humanoid.MoveDirection.Magnitude > 0 then
			defaultWalkAnimation = Instance.new("Animation")
			defaultWalkAnimation.AnimationId = defaultAnim3
			defaultWalkAnimationTrack = humanoid:LoadAnimation(defaultWalkAnimation)
			defaultWalkAnimationTrack:Play()
			defaultWalkAnimation:Destroy()
			defaultWalkAnimation = nil
		else
			defaultIdleAnimation = Instance.new("Animation")
			defaultIdleAnimation.AnimationId = defaultAnim1
			defaultIdleAnimationTrack = humanoid:LoadAnimation(defaultIdleAnimation)
			defaultIdleAnimationTrack:Play()
			defaultIdleAnimation:Destroy()
			defaultIdleAnimation = nil
		end
		animationPlaying = true
		M6D:Destroy()
		M6D = nil
		humanoid.JumpPower = defaultJump
		humanoid.WalkSpeed = defaultSpeed
		script.Parent.Bottom.LeftWheel.Anchored = true
		script.Parent.Bottom.LeftWheel.Orientation = Vector3.new(0, script.Parent.BodyAttach.Orientation.Y, script.Parent.BodyAttach.Orientation.Z)
		proximity.Enabled = true
		isPushed.Value = false
		cooldown = false
		while animationPlaying == true do
			if humanoid.MoveDirection.Magnitude ~= firstMagnitude then
				if defaultIdleAnimationTrack then
					if defaultIdleAnimationTrack.IsPlaying == true then
						defaultIdleAnimationTrack:Stop()
						defaultIdleAnimationTrack = nil
						animationPlaying = false
					end
					if defaultWalkAnimationTrack.IsPlaying == true then
						if humanoid.MoveDirection.Magnitude == 0 then
							defaultWalkAnimationTrack:Stop()
							defaultWalkAnimationTrack = nil
							animationPlaying = false
						end
					end
				elseif defaultWalkAnimationTrack then
					if humanoid.MoveDirection.Magnitude == 0 then
						defaultWalkAnimationTrack:Stop()
						defaultWalkAnimationTrack = nil
						animationPlaying = false
					end
				end
			end
			wait(0.1)
		end
	end
end

I really have no idea how any part of this script could turn my trash bin into a conveyor, but I have a suspicion that it might do with anchoring the part while it’s moving.

Just do the exact same script, except add

[your trash can].AssemblyLinearVelocity = Vector3.new(0, 0, 0)

after the line of code where you anchor the trash bin

that’s how default Roblox conveyors work: an anchored block with velocity
so to stop the conveyor effect, just get rid of the velocity

if your trash bin is made of several parts, you’ll have to set the velocity for all of them with a

for i, v in pairs([parts parent]:GetChildren()) do
   v.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
end
1 Like

Yep basically it has already been answered but simply put. Make sure that the AssemblyLinearVelocity is 0,0,0 after you have anchored the bin or it will turn into a conveyor

Thanks for the solution, but since AssemblyLinearVelocity does not replicate across the server/client boundary, is there an easy way to stop the trash bin from being a conveyor for all players?

Really the only way is to fire a remote event to the server and tell it to set the AssemblyLinearVelocity

Well thanks anyway, but I did it the other way around where I fired a remote event to all clients.
(all of the logic for the trash bin is handled server-side)