I’m having an issue where my new instances get destroyed, but then come back when a new one is created, I’ve tried both :Destroy() and parenting to nil, attached is part of my script, as well as a video gif of what’s happening. Serverscript
local DamageInd = Instance.new("TextLabel")
DamageInd.Parent = script.Parent.Hitbox.Indicator
DamageInd.Name = "Damage"
DamageInd.BackgroundTransparency = 1
DamageInd.Size = UDim2.new(0, 50, 0, 50)
DamageInd.TextColor3 = Color3.new(0.792157, 0.270588, 0.278431)
DamageInd.TextScaled = true
local X = math.random(25, 75) / 100
local Y = math.random(25, 75) / 100
DamageInd.Text = tostring(Calculated)
DamageInd.Visible = true
DamageInd.Position = UDim2.new(X, 0, Y, 0)
--print(X,Y)
local label = DamageInd -- The reference to the label
local ts = game:GetService("TweenService")
local tweenI = TweenInfo.new(5, Enum.EasingStyle.Quad)
local goals = {Position = UDim2.fromScale(X, -0.5)}
local tweenmove = ts:Create(label, tweenI, goals)
--^^^^^Making damage indicator move^^^^^--
local timeToFade = 2
local object = DamageInd
local tweenInfo = TweenInfo.new(timeToFade)
local goal = {}
goal.TextTransparency = 1
local tweenfade = ts:Create(object, tweenInfo, goal)
tweenmove:Play()
tweenfade:Play()
tweenfade.Completed:Connect(function()
DamageInd:Destroy()
end)
end
local hum = script.Parent.Humanoid
hum.HealthChanged:Connect(dmgIndicator)
end)