How would i make a text that pops up and says "In Combat" when you take damage?

So i have a script that does dmg when you punch someone, and i would like to set their “In Combat” boolean to true after they get hit. The problem is i can’t just do

local InCombat = target:FindFirstChild("InCombat")
	InCombat.Value = true
	
	task.delay(30, function()
		InCombat.Value = false
	end)

Since if i get multiple times, it wouldn’t stop from setting it to false on the first attack, instead i want it to reset to 30seconds each time you get hit.

Maybe you want something like this:

--Initializing variables
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(30)
local tween

--Code that would go in your punch method
local InCombat = target:FindFirstChild("InCombat")
InCombat.Value = true
if tween == nil then
    tween = TweenService:Create(InCombat, tweenInfo, {Value=false})
else
    tween:Cancel()
end
tween:Play()	

[/quote]

You can also use the tween.Completed event and add extra handling if you need it for whether the tween was “Completed” or it was “Cancelled”