How to make a bullet hole face properly

Im trying to make a paintball system where when the painball collides with something a splash effect comes up but right now its not being rotated properly, could someone refer me to a way i could fix this

Can you show us how you’re placing the holes?

local SplatsModule = {
	Images = {
		Splat1 = "http://www.roblox.com/asset/?id=18876066213",
		Splat2 = "http://www.roblox.com/asset/?id=18876056029",
		Splat3 = "http://www.roblox.com/asset/?id=18876063958",
		Splat4 = "http://www.roblox.com/asset/?id=18876060351",
	}	
}

function SplatsModule.FireSplat(pos, part, color)
	local keys = {}
	for key in pairs(SplatsModule.Images) do
		table.insert(keys, key)
	end

	local randomKey = keys[math.random(1, #keys)]
	local randomImage = SplatsModule.Images[randomKey]

	local splat = script.Splat:Clone()
	splat.Parent = workspace.DebrisCache
	splat.Size = Vector3.new(math.random() * 2 + 3, math.random() * 2 + 3, 0)
	splat.Position = pos
	splat.WeldConstraint.Part1 = part

	splat.Decal.Color3 = color

end




return SplatsModule

You can use the Normal property of raycast results to get the angle of the face.

1 Like

how would i go about doing this

This is a server script in the workspace.

local rayOrigin = Vector3.new(0, 20, 0)
local rayDirection = Vector3.new(0, -10, 0)

local part = Instance.new("Part")
part.Size = Vector3.one
part.Position = rayOrigin
part.Anchored = true
part.Parent = workspace

task.wait(1)

local raycastResult = workspace:Raycast(rayOrigin, rayDirection)

if raycastResult then
	
	local hitPosition = raycastResult.Position
	local normal = raycastResult.Normal

	part.CFrame = CFrame.lookAt(hitPosition, hitPosition + normal)
	-- This makes the part face in the direction of the normal vector
end
1 Like