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

Reflectance

BasePart

float

The Reflectance property determines how much a part reflects the skybox. A value of 0 indicates the part is not reflective at all, and a value of 1 indicates the part should fully reflect. Reflectance is not affected by /BasePart/Transparency, unless the part is fully transparent, in which case reflectance will not render at all. Reflectance may or may not be ignored depending on the /BasePart/Material of the part.


Code Samples


Touch Blink

This code sample causes a part to blink its Reflectance and a PointLight every time it is touched. It uses a pattern that prevents multiple concurrent function calls from fighting with each other.

local part = script.Parent

-- Add a light
local pointLight = Instance.new("PointLight", part)
pointLight.Brightness = 0
pointLight.Range = 12

local touchNo = 0
local function blink()
	-- Advance touchNo to tell other blink() calls to stop early
	touchNo = touchNo + 1
	-- Save touchNo locally so we can tell when it changes globally
	local myTouchNo = touchNo
	for i = 1, 0, -.1 do
		-- Stop early if another blink started
		if touchNo ~= myTouchNo then break end
		-- Update the blink animation
		part.Reflectance = i
		pointLight.Brightness = i * 2
		wait(0.05)
	end
end

part.Touched:Connect(blink)