Generate a Rounded Block

Sometimes I require a rounded block shaped part, but building those by hand is tedious, so I created a script to build them for you. It is not very good or optimized but it works.

local X = 2.25 -- Total Size X
local Y = 1.125 -- Total Size Y
local Z = 4 -- Total Size Z
local R = 0.375 -- Corner/Edge Diameter
// Above can go any value I want
local Part = Instance.new("Part", workspace)
Part.Size = Vector3.new(X, Y-R, Z-R)
Part.Anchored = true
Part = Instance.new("Part", workspace)
Part.Size = Vector3.new(X-R, Y, Z-R)
Part.Anchored = true
Part = Instance.new("Part", workspace)
Part.Size = Vector3.new(X-R, Y-R, Z)
Part.Anchored = true
for I = 1, 8 do
	local Ball = Instance.new("Part", workspace)
	Ball.Size = Vector3.new(R, R, R)
	Ball.Shape = "Ball"
	Ball.Anchored = true
	Ball.Position = Vector3.new((X-R)*(I%2 > 0 and -0.5 or 0.5), (Y-R)*(I%4 > 1 and -0.5 or 0.5), (Z-R)*(I > 4 and -0.5 or 0.5))
end
for I = 1, 4 do
	local Cylinder = Instance.new("Part", workspace)
	Cylinder.Size = Vector3.new(X-R, R, R)
	Cylinder.Shape = "Cylinder"
	Cylinder.Anchored = true
	Cylinder.Position = Vector3.new(0, (Y-R)*(I%2 > 0 and -0.5 or 0.5), (Z-R)*(I > 2 and -0.5 or 0.5))
end
for I = 1, 4 do
	local Cylinder = Instance.new("Part", workspace)
	Cylinder.Size = Vector3.new(Y-R, R, R)
	Cylinder.Orientation = Vector3.new(0, 0, 90)
	Cylinder.Shape = "Cylinder"
	Cylinder.Anchored = true
	Cylinder.Position = Vector3.new((X-R)*(I%2 > 0 and -0.5 or 0.5), 0, (Z-R)*(I > 2 and -0.5 or 0.5))
end
for I = 1, 4 do
	local Cylinder = Instance.new("Part", workspace)
	Cylinder.Size = Vector3.new(Z-R, R, R)
	Cylinder.Orientation = Vector3.new(0, 90)
	Cylinder.Shape = "Cylinder"
	Cylinder.Anchored = true
	Cylinder.Position = Vector3.new((X-R)*(I%2 > 0 and -0.5 or 0.5), (Y-R)*(I > 2 and -0.5 or 0.5))
end
11 Likes

Cool contribution. Can I use this code to make a plugin for rounded part creation? @asadefa

1 Like

This code works great! Would love to see this integrated into a plugin.

2 Likes

Sure. I have nothing to gain by stopping you.

1 Like