I have a roleplay game in development but i want to know how i’d be able to add blood particles/stans when they get shot.
when they get shot u probably can just add particle inside the bodypart that was hit. Then do :emit(givenNumber) and destroy the particle after given period of time
How would I go about coding this?
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local oldHealth = humanoid.Health
humanoid.HealthChanged:Connect(function(newHealth)
if newHealth < oldHealth then
oldHealth = newHealth
local emitter = Instance.new("ParticleEmitter")
emitter.Texture = "rbxassetid://0" --Change this to a blood-like texture.
task.delay(1, function()
emitter:Destroy()
end)
emitter.Parent = hrp
end
end)
This is just a general idea to steer you in the right direction.
https://developer.roblox.com/en-us/api-reference/class/ParticleEmitter