Preview:
local function fireLaser()
	-- Set an origin and directional vector
	local rayOrigin = caster.Position
	local rayDirection = Vector3.new(0, -100, 0)
 
	-- Build a "RaycastParams" object and cast the ray
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {caster.Parent}
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
 
	if raycastResult then
		local hitPart = raycastResult.Instance
		-- Check if the part resides in a folder, that it's fully visible, and not locked
		if hitPart.Parent == workspace.Tiles and hitPart.Transparency == 0 and not hitPart.Locked then
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter