I have been up for a few hours trying to solve this problem and I still cant quite figure it out. I have made a function that in theory should split a part into 2 separate parts but for some reason the script fails to resize the part. Any help would be much appreciated.
function split(part, face, delta)
local f1, f2, d = nil, nil, nil
if face == "X" then
f1, f2, d = Enum.NormalId.Left, Enum.NormalId.Right, part.Size.X
elseif face == "Y" then
f1, f2, d = Enum.NormalId.Top, Enum.NormalId.Bottom, part.Size.Y
elseif face == "Z" then
f1, f2, d = Enum.NormalId.Front, Enum.NormalId.Back, part.Size.Z
else
error("Face not provided")
end
local p = part:Clone()
p.Parent = part.Parent
p:Resize(f1, -(d-delta*d))
local p = part:Clone()
p.Parent = part.Parent
p:Resize(f2, -(d-(1-delta)*d))
print(-(d-delta*d), -(d-(1-delta)*d))
part:Destroy()
end
wait(5)
split(workspace.Part, "X", 0.75)
what exactly happens (or not) when you run the script?
And for others who don’t understand what is he trying to achieve imma say it. He wants to take a 4 * 2 * 3 part and cut it on the x axis at 75% of it’s length(for example). The result of it will be two parts one with the 3 * 2 * 3 size and one with 1 * 2 * 3 size.
If he wants to do that he can just create 2 new parts defined as the same properties he had except for a change dependent on half of the delta difference before the cut operation which is just 4 * 0.75 with a x movement of 0.5 since 1 delta difference on x
Yes thats what the :Resize is supposed to do but currently it does nothing, when the script runs it just creates 2 new parts in the exact same position and size as the old one.