CFrame angles and unions are acting weird

I am remaking my slicing script, but for some reason this happens.
This is what happens when I use the parts cframe:


Its clean, no clipping, no issues (its just the position and angle that isnt right)
This is when I use the camera part’s cframe:

theres clipping, and for some reason it’s always ONE SIDE thats glitched.

the only change made between videos is this.

local cf = part.CFrame -- parts cframe, the one thats doesn't clip
local cf = capart.CFrame -- the camera part/ camera subjects cframe
1 Like

Ok uh what is wrong with my script

1 Like

Not a clue. You’d have to share your code first.

1 Like

Server script:

local neg1 = game.ReplicatedStorage.Negative:Clone()
local neg2 = game.ReplicatedStorage.Negative:Clone()

--neg1.Parent = workspace
--neg2.Parent = workspace

local function slice(part:BasePart,cf:CFrame,player:Player)
	
	--local capart = player.Character:WaitForChild("CamPart")
	--local cf = capart.CFrame
	local cf = part.CFrame
	
	local width = 0.1
	
	local vel1 = part.AssemblyLinearVelocity
	local vel2 = part.AssemblyAngularVelocity
	part.Anchored = true
	neg1.CFrame = cf-cf.UpVector*neg1.Size.X/2
	neg2.CFrame = cf+cf.UpVector*neg2.Size.X/2
	
	local norun1 = part:SubtractAsync({neg1},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	local norun2 = part:SubtractAsync({neg2},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	
	neg1.CFrame = neg1.CFrame+cf.UpVector*width
	neg2.CFrame = neg2.CFrame-cf.UpVector*width
	
	local irun1 = part:SubtractAsync({neg1},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	local irun2 = part:SubtractAsync({neg2},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	
	irun1.Parent = workspace
	irun2.Parent = workspace
	
	for i,v in pairs(part:GetChildren()) do
		if v:IsA("Attachment") then
			local cf = v.WorldCFrame
			
			local mag1 = (irun1.Position-cf.Position).Magnitude
			local mag2 = (irun2.Position-cf.Position).Magnitude
			
			if mag1 < mag2 then
				v.Parent = irun1
				v.WorldCFrame = cf
			else
				v.Parent = irun2
				v.WorldCFrame = cf
			end
		end
	end
	
	local siz1 = irun1.Size
	local siz2 = irun1.Size
	
	irun1.Size += Vector3.new(0.0001,0.0001,0.0001)
	irun2.Size += Vector3.new(0.0001,0.0001,0.0001)
	
	local end1 = norun1:SubtractAsync({irun1},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	local end2 = norun2:SubtractAsync({irun2},Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Automatic)
	
	irun1.Size = siz1
	irun2.Size = siz2
	
	part:Destroy()
	norun1:Destroy()
	norun2:Destroy()
	
	local weld1 = Instance.new("WeldConstraint")
	weld1.Parent = end1
	weld1.Part0 = end1
	weld1.Part1 = irun1
	
	local weld2 = Instance.new("WeldConstraint")
	weld2.Parent = end2
	weld2.Part0 = end2
	weld2.Part1 = irun2
	
	end1.Parent = irun1
	end2.Parent = irun2
	
	local bc = BrickColor.new("Crimson")
	local mat = Enum.Material.Basalt
	
	end1.UsePartColor = true
	end1.BrickColor = bc
	end1.Material = mat
	
	end2.UsePartColor = true
	end2.BrickColor = bc
	end2.Material = mat
	
	irun1.UsePartColor = true
	irun2.UsePartColor = true
	
	irun1.Massless = part.Massless
	irun2.Massless = part.Massless
	
	end1.Massless = part.Massless
	end2.Massless = part.Massless
	
	irun1:SetAttribute("Sliceable",true)
	irun2:SetAttribute("Sliceable",true)
	
	--irun1.Anchored = false
	--irun2.Anchored = false

	--end1.Anchored = false
	--end2.Anchored = false
	
	irun1.AssemblyLinearVelocity = vel1
	irun1.AssemblyAngularVelocity = vel2
	irun2.AssemblyLinearVelocity = vel1
	irun2.AssemblyAngularVelocity = vel2

	end1.AssemblyLinearVelocity = vel1
	end1.AssemblyAngularVelocity = vel2
	end2.AssemblyLinearVelocity = vel1
	end2.AssemblyAngularVelocity = vel2
	
	local force = 10
	
	irun1:ApplyImpulse(cf.UpVector*(irun1.AssemblyMass*force))
	irun2:ApplyImpulse(cf.UpVector*-(irun2.AssemblyMass*force))
	
	irun1.Destroying:Connect(function()
		--end1:Destory()
	end)
	
	irun2.Destroying:Connect(function()
		--end2:Destory()
	end)
end

script.RemoteEvent.OnServerEvent:Connect(function(player,inst,cf)
	slice(inst,cf,player)
end)

The reason its kinda complicated is because it makes another union on the end to look like a wound.

1 Like