Boogie Woogie Not Working

Hello, I Am making A Boogie Woogie Spec, And im on the actual switching part, but Im having trouble with getting it to work 100% of the time. so basically what is happening Is that the First switch is fine, but the Second Switch After Using The Ability Once Just Doesnt Work, I have Turned off Cooldown In The Video Below So that Is Be Understood More Easily:

local script:

game.UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		if stun == false then
			stun = true
			if mouse.Target then
				if mouse.Target.Parent:FindFirstChild("Humanoid") then
					bf = true
					EAbility:Play()
					EAbility:GetMarkerReachedSignal("HIT"):Connect(function()
						script["Clap Sound"].PlaybackSpeed = 1 + (math.random(0,5)/10)
						script["Clap Sound"]:Play()
						task.wait(0.1)
						local root2 = mouse.Target.Parent.HumanoidRootPart
						cooldown:FireServer("Clap", ECooldownAmount)
						AttackRE:FireServer("Switch", root, root2)
					end)
				end
			end
			task.wait(EAbility.Length + 0.2)
			EAbility:Destroy()
			stun = false
		elseif stun == true then
			bf = false
			stun = false
		end
	end
end)

server script:

local rs = game:GetService("ReplicatedStorage")
local Remotes = rs:FindFirstChild("Remotes")
local AttackRE = Remotes:FindFirstChild("Attack")
AttackRE.OnServerEvent:Connect(function(Player,Type,Var1,Var2)
	if Type == "Switch" then
		local part1 = Instance.new("Part", workspace)
		part1.CFrame = Var1.CFrame
		part1.Size = Vector3.new(1,1,1)
		part1.Transparency = 1
		part1.Anchored = true
		part1.CanCollide = false
		local part2 = Instance.new("Part", workspace)
		part2.Size = Vector3.new(1,1,1)
		part2.Transparency = 1
		part2.Anchored = true
		part2.CanCollide = false
		part2.CFrame = Var2.CFrame
		Var2.CFrame = part1.CFrame
		Var1.CFrame = part2.CFrame
		part1:Destroy()
		part2:Destroy()
	end
end)

Can you please add print statements so you can check what lines are being reached the second time round, and which ones aren’t?

Also, can you ensure that there are no errors being outputted to console.

it is reaching the server script, but because it works some of the time thats why I didnt put that in the original post

All boogie woogie does is swap positions so idk why your server script is so long. All you could’ve probably done is:

Root1.CFrame = Root2.CFrame

This one line would swap the two positions and maintain the og orientations. Maybe im missing something you have going on in there.

No it wouldn’t.
It just moves Root1 to the position of Root2. You would need a third, temporary variable in order to have it function:

local Temp = Root1.CFrame
Root1.CFrame = Root2.CFrame
Root2.CFrame = Temp

Yeah, it should be reduced to the 3 lines above

I forgot that just assigns one position. Late nights really do mess up logical thinking

but are you actually going to help with the issue?

@SeargentAUS Most previous reply should maybe work. It could also you handling cool downs on the server