Rotating a cylindrical union based off ray hit position

The title may be a bit confusing, but this is what I mean:

https://gyazo.com/5ad6b2c96b5701000fb88fda0a063e4d
(For confusion I changed it from purple small parts to the following method as its much simpler and effective)

I am basically trying to have the blood part where the raycast hit, but since I’m not using a flat part, I need help.

This is my code:

local function BloodDo(dir,dist,m)
	local part,position,normal = Raycast(dir[1],dir[2],10,"W",bloodList)
	print(part)
	
	if part then
		if part.Name == "TunnelWay" then
			local wallBlood = bloodFolder.Arc:Clone()
			local blood = bloodFolder.Decals.Walls:GetChildren()[math.random(1,#bloodFolder.Decals.Walls:GetChildren())]:FindFirstChildOfClass("Decal"):Clone()
			blood.Parent = wallBlood
			
			local rot = 0 -- This is the number that needs to be in relation to where the raycast hit		
			wallBlood.CFrame = part.CFrame * CFrame.Angles(math.rad(rot),0,0)
	
			wallBlood.Parent = workspace.Filter
			game.Debris:AddItem(wallBlood,600)	
		else
			-- normal placement
		end
	end				
end

The rot variable needs to be the number relating to where the raycast hit.

This is how it should end up:

2 Likes