Idk why my damage indicator not working but its work last time
local TS = game:GetService("TweenService")
function roundNumber(num, numDecimalPlaces)
return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num))
end
local DamageBoard = game.ReplicatedStorage.DamageBoard
for i, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Model") then
if v:FindFirstChildWhichIsA("Humanoid") then
local hum = v:FindFirstChildWhichIsA("Humanoid")
local humH = hum.Health
hum.HealthChanged:Connect(function(Health)
local DamageDealted = roundNumber(humH-Health,1)
local damageGui = game.ReplicatedStorage.DamageBoard:Clone()
damageGui.Parent = v.PrimaryPart
damageGui.Damage.Text = DamageDealted
damageGui.ExtentsOffset = Vector3.new(math.random(-3,3),3,0)
if not v:FindFirstChild("CustomVFX") then
local hiteffect = script.HitEffect.Attach:Clone()
hiteffect.Parent = v.HumanoidRootPart
for i, v in pairs(hiteffect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(math.random(3,6))
end
end
game:GetService("Debris"):AddItem(hiteffect,2)
end
if not v:FindFirstChild("CustomSFX") then
local hiteffect = script.HitSoundTW:Clone()
hiteffect.Parent = v.HumanoidRootPart
game:GetService("Debris"):AddItem(hiteffect,2)
end
local tween = game.TweenService:Create(damageGui.Damage,TweenInfo.new(1.5),{TextTransparency = 1, TextStrokeTransparency = 1})
tween:Play()
tween.Completed:Connect(function()
damageGui:Destroy()
end)
end)
end
end
end