Blood splatter script spawning a lot of splatters at 0, 0

Somehow everytime I take damage my blood splatter script not only spawns splatters around the player, but also spawns roughly 10 splatters at 0, 0.

Can someone explain why this is happening and how I can fix this?


local splatids = {"408754747","408320359","408320438","508050982" }

local char = script.Parent.Parent
local human = char:WaitForChild("Humanoid")

local splatFolder = workspace.DamageDebris.BloodSplatters

	local headcf = char.Head.CFrame
	for i = 1, 15 do
		local a ="Part", nil)
		a.Parent = splatFolder
		a.Name = "BloodSplat"
		a.Size =,5),math.random(2,5),0.05)
		a.Transparency = 1
		a.CanCollide = false
		a.Anchored = true
		local decal1 ="Decal", a)
		decal1.Name = "Blood1"
		decal1.Texture = "rbxassetid://"..splatids[math.random(1, 4)]
		local decal2 ="Decal", a)
		decal1.Name = "Blood2"
		decal2.Texture = decal1.Texture or decal2.Parent.Blood1.Texture
		decal2.Face = "Back"
		local dir =,50),math.random(-50,50),math.random(-50,50)).Unit * 20
		local ray =, dir)
		local part,pos,normal = workspace:FindPartOnRay(ray, char, false, true)
		if part ~= nil then
			a.CFrame =,pos + normal)
			a.Parent = splatFolder
		game:GetService("Debris"):AddItem(a, 30)

You’re spawning blood splatters before doing the raycast check. You should only be spawning them if the ray hits something (inside the if statement)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.