Penetration hole

Hello. im trying make script for acs that makes hole on some materials but,
i don’t know how to place attachments correctly
this is what i want to make
image
[Left - Processed]
[Right - Giving u an idea what to do]
Each colored part is representing an attachment position

this is my code

local bulletholesize = .125
local Hardness = {
	[Enum.Material.WoodPlanks] = 0.2,
}


function Penetrate(Part:BasePart,CF:CFrame,Material:Enum.Material,BPn:number,Dist:number,Side:string)
	if Hardness[Material] ~= nil then
		local Penetrated = (BPn*Hardness[Material])/Dist-Part.Size[Side]
		if Penetrated > 0 then
			local PBtm,PTop,PLft,PRgt = Part:Clone(),Part:Clone(),Part:Clone(),Part:Clone()
			local AB,AT,AL,AR = Instance.new("Attachment",Part),Instance.new("Attachment",Part),Instance.new("Attachment",Part),Instance.new("Attachment",Part)
			local Middle = CF.Position+(CF.LookVector*-Part.Size[Side]/2)
			local P = (Middle - Part.Position)
			AB.WorldPosition = Vector3.new(0,P.Y+bulletholesize/2-Part.Size.Y/2,0)+Part.Position
			AT.WorldPosition = Vector3.new(0,-P.Y-bulletholesize/2+Part.Size.Y/2,0)+Part.Position
			AL.WorldPosition = Vector3.zero -- i just gave up here
			AR.WorldPosition = Vector3.zero
		end
	end
end

extra details. yes 4 attachments means there will be 4 parts

welp this is sad…
nobody responded

So, are you trying to make it so there are holes in the part where those attachments are? I am not yet sure about what you are trying to accomplish. What is the image showing specifically? Also, what is acs, I have no idea sorry.

image
u can see wheres the attachment, there are the block. the attachments are working as position placeholder. (the cyan part in the half transparent block is the bullet hitting position)

You’re trying to make a hole in a part by destroying the original part and creating 4 new parts around it?

Are you looking for that or for a method involving unions?

yea. thats correct
‘1’2’3’4’5’6’7’8’

Here’s the code to do it with unions:

local bullet = --a part representing the area to be removed
local hit = --path to the part being hit

local result: UnionOperation = hit:SubtractAsync({bullet})
result.UsePartColor = true 
result.Name = hit.Name 
--here you may want to clone textures/decals into the new instance
result.Parent = hit.Parent 
hit:Destroy()
bullet:Destroy()
hit = result 

the reason i switched from unions is because they take too much time to load in after some shoots

the activity today is crazy lol

really nobody can just do simple math?
cuz i dont

solved this by myself
11111111

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.