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

Getting a union to resize only by one face?

I'm having trouble resizing a union via a script. I'm aware that a union's size must stay consistent and can't be squashed and stretched like a mesh, however, what I'm looking for is to replicate resizing a union like how you could using studio's resize tool, shown visually here.

I've tried the :Resize function that's inside BaseParts in order to resize just a singular face, but since a union's size needs to remain consistent, it didn't do anything differently. And I can't find a way to move the part backwards along with resizing, since the part in question is welded to a tool handle, and its position gets finicky. Any suggestions?

Here's the relevant script:

for i = 1, 20 do
		character.Battery.Value = character.Battery.Value - 1
		wait(1)
		local light = character.Flashlight.Handle2
		character.Flashlight.Handle2.Size = Vector3.new(light.Size.X, character.Battery.Value / 10, light.Size.Z)
end

1 answer

✓ Accepted answer

You could try to subtract the union to preform the operation then reunion it after your done via the functions UnionAsync(), and SubtractAsync() Beware these functions can only be executed on the server, it will error if you try the client

Also heres a quick example:

local part1 = Instance.new("Part",workspace)
part1.Anchored = true
local part2 = Instance.new("Part",workspace)
part2.Anchored = true

local union part1:UnionAsync({part2})

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