PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

TopSurface

BasePart

SurfaceType

The TopSurface property determines the type of surface used for the +Y direction of a part. When two parts’ faces are placed next to each other, they may create a joint between them depending on the SurfaceType used on the touching faces. If set to Motor, the /BasePart/TopSurfaceInput determines how a motor joint should behave.

Most SurfaceTypes render a texture on the part face if the /BasePart/Material is set to Plastic. Some SurfaceTypes - Hinge, Motor and SteppingMotor - will render a 3D adornment instead. If this property is selected in the Properties window, it will be highlighted in the game world similar to that of a /SurfaceSelection.


Code Samples


Show All SurfaceTypes

This code sample shows what each SurfaceType looks like on a part. In addition, it creates a BillboardGui label on the part with a TextLabel that reflects the name of the current SurfaceType.

local part = script.Parent

-- Create a billboard gui to display what the current surface type is
local bbgui = Instance.new("BillboardGui")
bbgui.AlwaysOnTop = true
bbgui.Size = UDim2.new(0, 200, 0, 50)
bbgui.Adornee = part
local tl = Instance.new("TextLabel")
tl.Size = UDim2.new(0, 200, 0, 50)
tl.BackgroundTransparency = 1
tl.TextStrokeTransparency = 0
tl.TextColor3 = Color3.new(1, 1, 1) -- White
tl.Parent = bbgui
bbgui.Parent = part

local function setAllSurfaces(part, surfaceType)
	part.TopSurface = surfaceType
	part.BottomSurface = surfaceType
	part.LeftSurface = surfaceType
	part.RightSurface = surfaceType
	part.FrontSurface = surfaceType
	part.BackSurface = surfaceType
end

while true do
	-- Iterate through the different SurfaceTypes
	for _, enum in pairs(Enum.SurfaceType:GetEnumItems()) do
		tl.Text = enum.Name
		setAllSurfaces(part, enum)
		wait(1)
	end
end