this code.
local playerName = "AlphonsoGames"
local function createBloodCube(hitPosition, hitNormal)
local size = Vector3.new(5, 0.01, 5) -- Size of the cube
local emitterSize = NumberSequence.new(5) -- Particle size
-- Spawn the neon cube
local cube = Instance.new("Part")
cube.Size = size
cube.BrickColor = BrickColor.White()
cube.Material = Enum.Material.Neon
cube.Transparency = 0.99
cube.Shape = Enum.PartType.Block
cube.Anchored = true
cube.CanCollide = false
cube.Position = hitPosition
cube.CFrame = CFrame.new(hitPosition, hitPosition + hitNormal) * CFrame.Angles(math.rad(90), 0, 0)
cube.Parent = workspace
-- Splatter sound
local splat = Instance.new("Sound", cube)
splat.SoundId = "rbxassetid://7551589091"
splat.Volume = 2
splat.PlaybackSpeed = 1.5
splat:Play()
-- Blood particle
local attachment = Instance.new("Attachment", cube)
local particle = Instance.new("ParticleEmitter", attachment)
particle.LightInfluence = 1
particle.Lifetime = NumberRange.new(0.25)
particle.LockedToPart = true
particle.Transparency = NumberSequence.new{
NumberSequenceKeypoint.new(0, 0),
NumberSequenceKeypoint.new(0.5, 0.74375),
NumberSequenceKeypoint.new(1, 0.74375)
}
particle.Drag = 50
particle.Speed = NumberRange.new(0.1)
particle.ZOffset = 0.5
particle.VelocityInheritance = 1
particle.Rate = 50
particle.Size = emitterSize
particle.Texture = "rbxassetid://15731669832"
particle.Orientation = Enum.ParticleOrientation.VelocityPerpendicular
game:GetService("Debris"):AddItem(cube, 25)
end
local function monitorPlayerTouch(player)
local char = player.Character or player.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local touchingParts = {}
root.Touched:Connect(function(hit)
if hit and hit:IsA("BasePart") and hit.Anchored then
touchingParts[hit] = tick()
end
end)
root.TouchEnded:Connect(function(hit)
if hit and touchingParts[hit] then
touchingParts[hit] = nil
end
end)
-- Loop check every 1 second
task.spawn(function()
while char and char.Parent do
for part, lastTouchTime in pairs(touchingParts) do
if tick() - lastTouchTime < 2 then
-- Raycast downward to find exact surface
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {char}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
rayParams.IgnoreWater = true
local raycastResult = workspace:Raycast(root.Position, Vector3.new(0, -5, 0), rayParams)
if raycastResult then
createBloodCube(raycastResult.Position, raycastResult.Normal)
end
end
end
task.wait(1) -- spawn blood cube every 1 second if still touching
end
end)
end
-- MAIN
local player = game.Players:FindFirstChild(playerName)
if not player then
warn(("Player %q not found!"):format(playerName))
return
end
monitorPlayerTouch(player)
player.CharacterAdded:Connect(function(newChar)
monitorPlayerTouch(player)
end)
rework the bleeding effect.