I want to make that the player clones a ball from the replicated storage in front of them and then it got subtracted from the ground so it looks like the player digged a hole
heres the script
local replicatedStorage = game:GetService("ReplicatedStorage")
local spawnObjectEvent = replicatedStorage:WaitForChild("SpawnObjectEvent")
local objectToDuplicate = replicatedStorage:WaitForChild("Dig Zone")
local Dirt = game.Workspace.Dirt
local SubtractedArea = game.Workspace.Digged:GetChildren()
local function placeObject(player)
local clonedObject = objectToDuplicate:Clone()
clonedObject.Parent = workspace.Digged
local forwardVector = player.Character.HumanoidRootPart.CFrame.LookVector
local spawnPosition = player.Character.HumanoidRootPart.Position + (forwardVector * 2)
clonedObject.Position = spawnPosition
local Unionize = Dirt:SubtractAsync(SubtractedArea)
replicatedStorage.ObjectAdded:FireAllClients(clonedObject)
end
spawnObjectEvent.OnServerEvent:Connect(placeObject)
and it working fine until the subtract part, in the output the error is this:
Something went wrong. CSG returned error code -19. Please file a bug report, preferably with a file containing the problematic object(s).
can someone help please god i cant take this anymore