[Full Release] UIStroke Improvements: Scaling, Offsets, and More!

Just realized we can finally draw triangles without using images with this update!


TriangleFrame.rbxm (2.8 KB)

local STROKE_FRAME = Instance.new("Frame")
-- have to do this otherwise clips descendants will trigger :(
-- roblox pls make clips descendants work with rotation so this hacky method wont be needed
STROKE_FRAME.Position = UDim2.fromScale(-0.499, -0.499)
STROKE_FRAME.Size = UDim2.fromScale(0.5, 0.5)
STROKE_FRAME.Name = "StrokeHolder"
STROKE_FRAME.BorderSizePixel = 0
STROKE_FRAME.Transparency = 1

local STROKE = Instance.new("UIStroke")
STROKE.StrokeSizingMode = Enum.StrokeSizingMode.ScaledSize
STROKE.LineJoinMode = Enum.LineJoinMode.Bevel
STROKE.Thickness = 4

local function create_triangle_frame(color: Color3, size: UDim, position: UDim2): Frame
	local holder_frame = Instance.new("Frame")
	holder_frame.Size = UDim2.new(size, size)
	holder_frame.ClipsDescendants = true
	holder_frame.Position = position
	holder_frame.Transparency = 1

	local stroke_frame = STROKE_FRAME:Clone()
	local stroke = STROKE:Clone()

	stroke.Color = color
	stroke.Parent = stroke_frame
	stroke_frame.Parent = holder_frame
	return holder_frame
end
2 Likes