Hello developers!
I’ve decided to rewrite a blood system created by @R0mAAn1CH for personal preference. Anyway, I’ve simply want the blood to stick to walls but don’t know how to do so.
local BloodModule = {}
BloodModule.CreateBlood = function(BAmount,Pos)
for i=1, BAmount do
local BloodDrip = script.BloodDrip:Clone()
game:GetService("Debris"):AddItem(BloodDrip,5)
BloodDrip.Position = Pos.Position
BloodDrip.Velocity = Vector3.new(math.random(-40, 40), math.random(0, 75), math.random(-40, 40))
BloodDrip.Parent = workspace.Debris
local DetectHit = coroutine.create(function()
local OnHit = false
game:GetService("RunService").RenderStepped:Connect(function()
if not OnHit then
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {workspace.Debris, BloodDrip, Pos.Parent}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local raycastResult = workspace:Raycast(BloodDrip.Position,Vector3.new(0, -1, 0),raycastParams)
if raycastResult then
if raycastResult.Instance.Anchored == true and raycastResult.Instance.CanCollide == true then
OnHit = true
local BloodPuddle = script.BloodSplatter:Clone()
game:GetService("Debris"):AddItem(BloodPuddle,5)
BloodPuddle.Position = raycastResult.Position
BloodPuddle.Parent = workspace.Debris
--//Tween
local TweenGoal = {Size = Vector3.new(math.random(-10,50)/10, 0, math.random(-10,50)/10)}
local Tweeninfo = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)
local Tween = game:GetService("TweenService"):Create(BloodPuddle,Tweeninfo,TweenGoal):Play()
BloodDrip:Destroy()
end
end
end
end)
end)
coroutine.resume(DetectHit)
task.wait()
end
end
return BloodModule