Hi! I made a tool that allows you to cut ice. But a problem appeared, firstly, there is a problem with collision, that is, I cannot get into the hole, despite the fact that PreciseConvexDecomposition is selected. Secondly, this happens with a very long delay. I have attached the video below, as well as the codes.
External MediaLocal script
local tool = script.Parent
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local character = plr.Character
local hrp = character:WaitForChild("HumanoidRootPart")
tool.Activated:Connect(function()
local hitTarget = mouse.Target
local hitPosition = mouse.Hit.Position
if hitTarget and hitPosition then
local distance = (hitPosition - hrp.Position).Magnitude
if distance < 15 then
script.Parent.CutEvent:FireServer(hitTarget, hitPosition)
end
end
end)
Server script
script.Parent.CutEvent.OnServerEvent:Connect(function(plr, hitTarget, hitPosition)
if hitTarget.Name == "Ice" then
local iceTool = game.ServerStorage.Storage.Items.Misc.Ice:Clone()
local cutPart = Instance.new("Part")
cutPart.Shape = Enum.PartType.Cylinder
cutPart.Position = hitPosition
cutPart.Orientation = Vector3.new(0, 90, 90)
cutPart.Size = Vector3.new(4.5, 4, 4.5)
cutPart.Anchored = true
cutPart.Transparency = 1
cutPart.CanCollide = false
cutPart.CanQuery = false
cutPart.CanTouch = false
cutPart.Parent = workspace
iceTool:PivotTo(CFrame.new(Vector3.new(cutPart.Position.X, hitTarget.Position.Y + 1.5, cutPart.Position.Z)))
iceTool.Handle.Orientation = Vector3.new(cutPart.Orientation.X, cutPart.Orientation.Y, cutPart.Orientation.Z)
iceTool.Handle.Size = Vector3.new(1, 4.5, 4.5)
local union = hitTarget:SubtractAsync({cutPart}, Enum.CollisionFidelity.PreciseConvexDecomposition, Enum.RenderFidelity.Precise)
union.Parent = hitTarget.Parent
iceTool.Parent = workspace.Props
union.Name = "Ice"
cutPart:Destroy()
hitTarget:Destroy()
end
end)
Are there any options here to fix both problems?