How to temporarily disable the collisions of two players when a certain move is initiated

Hello people,

I’ve encountered quite a bit of a problem in my game, the move is essential for completing the character’s moveset so fixing this bug is really necessary for me.

As the title states, I’m trying to figure out on how to disable the collisions of two players when a certain move is initiated. The move I’ve made makes the player slams their opponent on the floor three times, the issue is that due to the player collisions, it makes it look really messy.

GIF:
https://gyazo.com/210c8f2ab44a83dc4547fd8d97d61b95

It sometimes even fling the players and it doesn’t look nice.

This is the script:

-- Function

function LightingBloomEffect()
	local rtasdasdas = game.TweenService:Create(game.Lighting.ColorCorrection,TweenInfo.new(.1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out), {Brightness = 0.8})
	local loopsizeincrease = game.TweenService:Create(game.Lighting.ColorCorrection,TweenInfo.new(.1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out), {Brightness = 0})
	rtasdasdas:Play()
	task.wait(.3)
	loopsizeincrease:Play()
end

function HitSound(part, stuffid)
	local NewSound = Instance.new("Sound")
	NewSound.SoundId = "rbxassetid://"..stuffid
	NewSound.Parent = part
	NewSound:Play()
	game.Debris:AddItem(NewSound, 3)
end

local Remote = game.ReplicatedStorage.Moves["Broly [DBS]"].Choke
Remote.OnServerEvent:Connect(function(player)
	
local function weld(parent, p0, p1, c0, c1)
		local wel = Instance.new("Motor6D")
		wel.Part0 = p0
		wel.Part1 = p1
		wel.C0 = c0
		if c1 ~= nil then
			wel.C1 = c1
		end
		wel.Parent = parent
		return wel
	end
	
	local Meshs = script:WaitForChild("Meshs")
	local Anims = script:WaitForChild("Anims")
	local char = player.Character
	local hum = char:WaitForChild("Humanoid")
	local root = char:WaitForChild("HumanoidRootPart")
	root.Anchored = true
	
	local ChokeBegin = hum:LoadAnimation(Anims.Crack)
	ChokeBegin:Play()
	
	local hitbox = Meshs:WaitForChild("HitBox"):Clone()
	hitbox.CFrame = char:WaitForChild("Right Arm").CFrame
	hitbox.Parent = char:WaitForChild("Right Arm")
	
	local weld = Instance.new("ManualWeld")
	weld.Part0 = hitbox
	weld.Part1 = char:WaitForChild("Right Arm")
	weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
	weld.Parent = weld.Part0
	
		
	hitbox.Touched:Connect(function(Hit)
		if Hit:IsA("MeshPart") or Hit:IsA("Part") then
			if not Hit:IsDescendantOf(char) then
				local Eroot = Hit.Parent:FindFirstChild("Head")
				local Ehum = Hit.Parent:FindFirstChild("Humanoid")
				if hum ~= nil and Hit.Parent.Name ~= player.Name and Hit.Parent:FindFirstChild("ChokedAttackedDBS") == nil and Hit.Parent.Values.IFrame.Value ~= true then
					local LimbRight = char["Right Arm"]
					local weld2 = Instance.new("ManualWeld")
					game.Debris:AddItem(weld2,4)
					weld2.Part0 = Eroot
					weld2.Part1 = LimbRight
					weld2.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
					weld2.Parent = weld2.Part0	
					local STUNVALUE = Instance.new("Model", Eroot.Parent)
					STUNVALUE.Name = "Stunned"
					game.Debris:AddItem(STUNVALUE, 3)
					HitSound(Eroot, 9315284744)
					
					if Ehum then
						hitbox:Destroy()
						coroutine.resume(coroutine.create(function()
							repeat
								task.wait()
							until Ehum.Health < 5
							root.Anchored = false
							char.Humanoid.Health = char.Humanoid.Health + 50
						end))
						char.Values.IFrame.Value = true
						Eroot.Parent.Values.IFrame.Value = true
						local ChokeLoop = hum:LoadAnimation(Anims.CrackHold)
						ChokeLoop:Play()
						HitSound(Eroot, 9345618728)
						task.wait(2)
						Ehum:TakeDamage(15)
						local value = Instance.new("StringValue", Hit.Parent)
						value.Name = "ChokedAttackedDBS"
						game.Debris:AddItem(value, 2)
						HitSound(Eroot, 9354393288)
						ChokeLoop:Stop()
						local TripleSlam = hum:LoadAnimation(Anims.TripleSlam)
						TripleSlam:Play()
						spawn(function()
							for i = 1,3 do
								HitSound(Eroot, 9067646467)
								local hitval = Instance.new("NumberValue")
								hitval.Value = 5
								hitval.Parent = player.PlayerGui.HitsGui.Indi 
								game.Debris:AddItem(hitval, game:GetService("ReplicatedFirst").HitTime.Value)
								
								LightingBloomEffect()
								local wave = Meshs:WaitForChild("Wave"):Clone()	
								wave.Parent = workspace
								wave.CFrame = root.CFrame * CFrame.Angles(math.rad(180),0,0)
								game:GetService("TweenService"):Create(wave,TweenInfo.new(1),{Size = wave.Size + Vector3.new(80,5,80),Transparency = 1}):Play()	
								task.wait(.34)
							end
						end)
						Eroot.Parent.Values.IFrame.Value = false
					end
				end
			end
		end
	end)
	spawn(function()
		task.wait(1)
		char.Values.IFrame.Value = false
		root.Anchored = false
		hitbox:Destroy()
	end)
end)

Any kind of help would be appreciated.

You can open the Collision Groups in the model tab, then create another collision group that can collide with the default one, but not with itself
Example:
image_2022-04-13_130858015

i wrote a small example code:

local physics = game:GetService("PhysicsService")

local part1 = game.Workspace.part1
local part2 = game.Workspace.part2

wait(2)

physics:SetPartCollisionGroup(part1,"NonCollidedPlayers")
physics:SetPartCollisionGroup(part2,"NonCollidedPlayers")

wait(2)

physics:SetPartCollisionGroup(part1,"Default")
physics:SetPartCollisionGroup(part2,"Default")

what this will do is wait 2 seconds, then the parts won’t collide with eachother for 2 seconds, and after these 2 seconds they will collide with eachother again

for a character it would be pretty much the same thing, but you can get all the parts inside the player with a for loop

hope that helps

I’ll try using this method and see if it solves my issue.