Im trying to make a blood splatter script that uses raycasts to spawn a part with a blood splatter decal. However, the rotation does not seem to be working.
Here’s the code:
local BloodSplatterOrigin = workspace.BloodSplatterRaycastOrigin
while true do
local xRange = 200
local yRange = 200
local zRange = 200
local randomVector = Vector3.new(
(math.random() - 0.5) * xRange,
(math.random() - 0.5) * yRange,
(math.random() - 0.5) * zRange
)
local RaycastResult = workspace:Raycast(BloodSplatterOrigin.Position, randomVector)
if RaycastResult and RaycastResult.Instance then
local BloodSplatter = game:GetService("ReplicatedStorage").Effects.BloodSplatter:Clone()
BloodSplatter.Parent = workspace
BloodSplatter.Position = RaycastResult.Position
BloodSplatter.Rotation = RaycastResult.Normal
end
print(RaycastResult)
task.wait(0.2)
end
The goal i want to achieve is that the blood part will be rotated parallel to the part’s surface.