Collision Groups And Anchoring During Gripping Animation

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’ve been making a grip and carry system for my game and the carry works just fine but the grip is really buggy. The two humanoids don’t go in the right position especially the player who is gripping as they are standing up during the animation.

  2. What is the issue? Include screenshots / videos if possible!
    Screenshot 2024-09-22 085729

Here’s the code I used, sorry if it’s hard to read im kinda new to scripting.

local Target = self:FindNearestDowned()
		
		if Target then
			for _, Part in self.Character:GetDescendants() do
				if Part:IsA("BasePart") then
					Part.CollisionGroup = "Entity"
				end
			end
			for _, Part in Target:GetDescendants() do
				if Part:IsA("BasePart") then
					Part.CollisionGroup = "Entity2"
				end
			end
			
			self.Character.HumanoidRootPart.CollisionGroup = "Entity"
			Target.HumanoidRootPart.CollisionGroup = "Entity2"
			AllLoadedCharacters[Target].MyRagdoll:Destroy()
			AllLoadedCharacters[Target].GettingGripped = true
			self.Character.HumanoidRootPart.Orientation = CFrame.new(0, 0, 0).Position
			Target.HumanoidRootPart.Orientation = CFrame.new(0, 0, 0).Position
			local AnimationTrack = Instance.new("Animation")
			AnimationTrack.AnimationId = SettingsModule.GripTargetAnim

			self.ThereGripAnim = Target.Humanoid:LoadAnimation(AnimationTrack)
			self.Ended = false
			self.Gripping = true
			self.MyGripAnim:Play()
			self.ThereGripAnim:Play()
			self.Character.HumanoidRootPart.CFrame = Target.HumanoidRootPart.CFrame
			
			self.Humanoid.AutoRotate = false
			self.Character.Torso.Anchored = true

			self.LastGrippedPerson = Target
			Target.Humanoid.AutoRotate = false
			Target.Torso.Anchored = true
			
			repeat wait() until not	self.MyGripAnim.IsPlaying
			
			if AllLoadedCharacters[Target] then
				AllLoadedCharacters[Target].GettingGripped = false
				AllLoadedCharacters[Target].GettingCarried = false
				self.Gripping = false
			end
			
			local cv = CombatTable[self.Character]
			local p = game.Players:GetPlayerFromCharacter(self.Character)

			cv.Posture = 0
			if p then
				game.ReplicatedStorage.Posture:FireClient(p,cv.Posture)
				playerHandler.ChangeValue(p,"exp",5)
			end
			local hpgain = (self.Humanoid.MaxHealth - self.Humanoid.Health)/1.3
			self.Humanoid.Health = self.Humanoid.Health + hpgain
			
			wait(1)
			Target.Humanoid:Destroy()
			self.Character.Torso.Anchored = false
			self.Humanoid.AutoRotate = true
			if AllLoadedCharacters[Target].Knocked then
				AllLoadedCharacters[Target].MyRagdoll:Build()
			end
			
			self:AddCarryCooldown()

		end
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried setting the collision groups to seperate ones and not anchoring the two seems to do the trick but I don’t want the player to be able to move around while gripping them and vice versa.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I can include a clip if it helps.

1 Like