So, I was making a blood system inspired by Blood Flow, and it works fine. But, it have a problem: It's not detecting collisions. What it should be: When the meatball fly off your body and something touchs it, a blood splat appears in the same positions has the meatball, but it isn't detecting collision. If I turn CanCollide true, it don't detect collision, if I put CanCollide false, it don't detect collision too. People said to I use Raycasting, but I don't know how could I do that. Here's my code:
--//Players\\-- local Players = game:GetService('Players') --//Workspace\\-- local BloodParts = game:GetService('Workspace').BloodParts --//ReplicatedStorage\\-- local ReS = game:GetService('ReplicatedStorage') local BloodMeshes = ReS.BloodMeshes --//RunService\\-- local RuS = game:GetService('RunService') --//TweenService\\-- local TS = game:GetService('TweenService') --//Delay and Others\\-- Debounce = false --//Scripting\\-- Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local Humanoid = Character.Humanoid local OldHealth = Humanoid.Health Humanoid.HealthChanged:Connect(function(NewHealth) local HealthDifference = OldHealth - NewHealth OldHealth = NewHealth if HealthDifference <= 0 then return end local NumberOfDrops = math.floor(HealthDifference) if Debounce == false then Debounce = true for i = 0, NumberOfDrops do local MeatBall = BloodMeshes.MeatBall01:Clone() MeatBall.Position = Player.Character.Humanoid.RootPart.Position + Vector3.new(0, 2, 0) local BodyVelocity = Instance.new('BodyVelocity', MeatBall) BodyVelocity.MaxForce = Vector3.new(1000000000, 1000000000, 1000000000) BodyVelocity.P = Player.Character.Humanoid.RootPart.Position + Vector3.new(0, 2, 0) BodyVelocity.Velocity = Vector3.new(math.random(-10, 10), math.random(3, 6), math.random(-10, 10)) local function RemoveBodyVelocity() wait(math.random(0.2, 0.3)) BodyVelocity:Destroy() end MeatBall.Anchored = false MeatBall.Parent = BloodParts MeatBall.BloodLaunch:Play() RemoveBodyVelocity() local Touch function Touch() RuS.Heartbeat:Connect(function() MeatBall.Touched:Connect(function(Hit) if not Hit.Parent:FindFirstChildWhichIsA('Humanoid') then if not Hit.Name == 'Blood01' then if not Hit.Parent.Name == 'BloodParts' then if not Hit.Name == 'HumanoidRootPart' then if Debounce == true then Debounce = false MeatBall.Anchored = true MeatBall.Transparency = 1 MeatBall.BloodTouch:Play() local BloodDropSize = math.random(1, 3.816) local BloodSplat = BloodMeshes.Blood01:Clone() BloodSplat.Size = Vector3.new(0.05, 1, 0.05) local SizeTween01 = TS:Create(BloodSplat, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0), {Size = Vector3.new(BloodDropSize, 0.05, BloodDropSize)}) local TransparencyTween01 = TS:Create(BloodSplat, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0), {Transparency = 1}) local PositionX = MeatBall.Position.X + math.random(-1, 2) / 10 local PositionY = MeatBall.Position.Y local PositionZ = MeatBall.Position.Z + math.random(-1, 2) / 10 BloodSplat.Position = Vector3.new(PositionX, PositionY, PositionZ) BloodSplat.Parent = BloodParts SizeTween01:Play() game:GetService('Debris'):AddItem(BloodSplat, 15) SizeTween01.Completed:Wait() MeatBall:Destroy() wait(0.2) Debounce = true end else return end else return end else return end end end) end) end Touch() end wait(0.7) Debounce = false end end) end) end)
Tsu Washington / SovietFurryBruh.