What solutions have you tried so far? Did you look for solutions on the Developer Hub?
local Angle = 0
for i = 1,30 do
local Size = math.random(2,3)
local Part = Instance.new("Part")
Part.Anchored = true
Part.Size = Vector3.new(Size,Size,Size)
Part.CFrame = CFrame.new(Target.Position) *
CFrame.fromEulerAnglesYXZ(math.rad(Angle),0,0)
Part.Parent = workspace.DebrisFolder
game.Debris:AddItem(Part,113)
end
part.CFrame = wall.CFrame.Rotation
-- you might need to rotate the part if its not facing the correct way
-- part.CFrame *= CFrame.fromOrientation(0, math.rad(90), 0)
Part.Position = Target.Position
You need to use the surface normal for this. A surface normal is a vector that is perpendicular to a given object. In the image below, It shows the surface normal (direction its pointing) of given point on the curved plane.
You can do this on roblox using raycasts like this:
local rayOrigin = character.HumanoidRootPart
local rayDirection = Vector3.new(0, -100, 0) * 100 --direction the ray shoots * distance you want it to shoot
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {character.HumanoidRootPart} --blackists yourself from getting hit with the ray
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
print("Surface normal at the point of intersection:", raycastResult.Normal)