Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is it possible to negate a part through script?

So I am new to scripting, I have little experience and was wondering if there was any way to negate a part in a script as you are able to do so in the model tab. If so, is there anything else for union? Please let me know and thank you.

2 comments

0

I found a thread similar to your question that may be useful. https://devforum.roblox.com/t/negating-tool-through-scripts/564323

0

Why would you do this?

1 answer

You can use BasePart:SubtractAsync(). It is basically the opposite of BasePart:UnionAsync().

local PartA = workspace.PartA
local PartB = workspace.PartB

--imagine PartB is within PartA
local success, negatedPart = pcall(function()
	return PartA:SubtractAsync({PartB})
end)

if success and negatedPart then -- if PartB was within PartA and it was a success on negating the part
	print("PartA has been negated through a script! :D")
end

1 comment

0

when I put this, the output showed that it worked because it printed the string.. Although when i look in game, nothing visually changed in neither the client or the server.

This discussion is preserved as it was. New answers, comments, and votes are closed.