--check mass to see if object is large enough to spray blood on

if dmg<1000 then
	for x = 1, math.floor(dmg*(math.random(1,7)*.105)) do
		local bloodRay = Ray.new(origin,(game.Players.LocalPlayer.Character.Torso.CFrame.p.unit * Vector3.new(math.random(-7,7)/60,math.random(-7,7)/60,math.random(-7,7)/60)).unit * 12)
		local hitPart, hitPoint = workspace:FindPartOnRayWithIgnoreList(bloodRay,{workspace.CurrentCamera,humanoid.Parent})
		if hitPart and hitPart.Transparency==0 and hitPart:GetMass() > 5 and hitPart.Anchored then
			local blood = Instance.new("Part",game.Workspace["Ray_Ignore"])

			blood.formFactor = "Custom"
			blood.Size = Vector3.new(math.random(1,3600)*.001,0.2,math.random(1,3600)*.001)
			blood.BrickColor = BrickColor.new("Bright red")
			blood.Anchored = true
			blood.CanCollide = false
			Instance.new("BlockMesh",blood).Scale = Vector3.new(math.random(0,112)*.001,0.1,math.random(0,112)*.001)
			local sc=script.bl:clone()
			sc.Parent=blood
			sc.Disabled=false
			blood.TopSurface = "Smooth"
			blood.BottomSurface = "Smooth"
			blood.Reflectance=0.2
			blood.Transparency=1
			local decalpick=math.random(1,3)
			if decalpick==1 then
			local crap=script.Decal1:clone()
			crap.Name="Decal"
			crap.Parent=blood
			elseif decalpick==2 then
			local crap=script.Decal2:clone()
			crap.Name="Decal"
			crap.Parent=blood
			elseif decalpick==3 then
			local crap=script.Decal3:clone()
			crap.Name="Decal"
			crap.Parent=blood
			end
			local normal = GetSurfaceNormal(hitPart,hitPoint).unit
			if pcall(function()
				blood.CFrame = CFrame.new(hitPoint,hitPoint + normal) * CFrame.Angles(1.57,math.random(0,300)/100,0) end) then
			end
			end
		end
	end
end

local hp=game.Players.LocalPlayer.Character.Humanoid.Health



character.Humanoid.HealthChanged:connect(function(health)
	--[[if game.Workspace:FindFirstChild("Ray_Ignore") then
splatterBlood(game.Players.LocalPlayer.Character.Torso.Position,game.Players.LocalPlayer.Character.Humanoid,hp-health)
end]]--
hp=game.Players.LocalPlayer.Character.Humanoid.Health
healthGUIUpdate(health)
end)







