Is there a possible way to make union parts through negate all in client sided script?

You can write your topic however you want, but you need to answer these questions:

  1. I am making a planet destruction physics game and i use a union system to leave crates for planets when colliding

  2. I am making everything client sided since its a 1 player server and i am trying to escape from delay and lag, and if i use this script in client side it wont work

script:

local mainPart = script.Parent
local copy = script:Clone()

script.Parent.Touched:Connect(function(B)
local tee = Instance.new(“Explosion”)
tee.Parent = game.Workspace
tee.BlastRadius = 0.5
tee.TimeScale = 0.1
tee.Position = B.Position
local otherParts = {B}
if B.Transparency == 0 then
local success, newSubtract = pcall(function()
return mainPart:SubtractAsync(otherParts)
end)

-- If operation succeeds, position it at the same location and parent it to the workspace
if success and newSubtract then
	copy.Parent = newSubtract
	newSubtract.Position = mainPart.Position
	newSubtract.Parent = workspace
	newSubtract.UsePartColor = true
end

-- Destroy original parts which remain intact after operation
mainPart:Destroy()
for _, part in otherParts do
	part:Destroy()
end
end

end)

  1. I tried using remote events(eveb tough i am trying not to use them since it causes delay) but i didnt manage and i dont know any other way

does anybody know how to make this client sided(Union parts through negate), or at least without delay or lag?

The GeometryService API can be used on the client.

it works but i have a problem.
the part then instantly dissapears

whenever i insert the script it simply dissapears

Are you positioning and parenting correctly? The returned value is different for SubtractAsync with GeometryService - it will return an array of objects instead of an individual object. Also make sure you are destroying your main part last as it seems you are destroying the script along with it in your original script, ending the execution.

bro my bad i forgot to make the script if he touches the gravity hjitbox nothing happnes mb

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