The RaycastResult returns a dictionary with these indexes + values:
Instance - the instance/terrain cell that got hit by it
Position - the vector3 position it hit the instance/terrain cell
Material - the material of the instance/terrain cell that got hit by it
Normal - the normal of the face of the thing that got hit by the ray
So atleast for what you are asking for the position and the normal are the important things for you, the normal is pretty much where the specific face is looking at (so basically it would be one of the components of cframe), so you can make the blood face the normal vector.
I tried this, but it sortaaa works problem is the blood kinda tilts
local BloodSystem = function(Player)
if Player ~= nil then
local TweenService = game:GetService("TweenService")
local Character = Player.Character or Player.CharacterAdded:Wait();
local Humanoid = Character:WaitForChild("Humanoid");
local Leg = Character:WaitForChild("Left Leg");
local CurrentHumanoidHealth = Humanoid.Health;
local BloodParticle = script:WaitForChild("Blood_Particle");
local CastRayCast = function()
local RayDirection = Vector3.new(0, -1.5, 0)
local RayCastParameters = RaycastParams.new();
local RayOrgin = Leg.Position
RayCastParameters.FilterDescendantsInstances = {};
RayCastParameters.FilterType = Enum.RaycastFilterType.Blacklist
local BloodCastRay = workspace:Raycast(Leg.Position, RayDirection, RayCastParameters)
return BloodCastRay
end
local CreateBlood = function()
local BloodPosition = CastRayCast()
if BloodPosition then
local BloodPart = Instance.new("Part", workspace.Assets.BloodParticle)
BloodPart.Name = "Blood_Particle"
BloodPart.CanCollide = false
BloodPart.Anchored = true
BloodPart.Position = BloodPosition.Position
BloodPart.Orientation = Vector3.new(90,0,0)
BloodPart.Size = Vector3.new(4, 4, 0.001)
BloodPart.Transparency = 1
local BloodDecal = Instance.new("Decal", BloodPart)
BloodDecal.Name = "Blood"
BloodDecal.Texture = "rbxassetid://890286383"
end
end
Humanoid.HealthChanged:Connect(function(newHealth)
if newHealth < CurrentHumanoidHealth then
CurrentHumanoidHealth = newHealth
print("blood created")
CreateBlood()
end
end)
end
end
return BloodSystem