Sorry for bad english
statWindowOpened = true
local newFrame = FinalTemplate:Clone()
ClickSound:Play()
newFrame.PetPicture.Image = petImage
newFrame.PetPicture.Species.Text = Pet.Species
if Pet.Level < 30 then
local barSize = Pet.Experience/MAX_EXP[Pet.Level]
newFrame.Experience.Bar.Size = UDim2.new(barSize,0,1,0)
newFrame.Experience.Text.Text = "EXP: " .. tostring(Pet.Experience) .. "/" .. tostring(MAX_EXP[Pet.Level])
else
newFrame.Experience.Bar.Size = UDim2.new(1,0,1,0)
newFrame.Experience.Text.Text = "MAXIMUM EXP"
end
if Pet.Equipped then
newFrame.Equip.Text = "UnEquip"
else
newFrame.Equip.Text = "Equip"
end
newFrame.MoneyBoost.Text = "Money +" .. tostring(math.floor((Pet.MoneyBoost*100))/100)
newFrame.PowerBoost.Text = "Power +" .. tostring(math.floor((Pet.PowerBoost*100))/100)
newFrame.Level.Text = "LEVEL: " .. tostring(Pet.Level)
newFrame.Equip.Activated:Connect(function()
local result, message = EquipPet:InvokeServer(petId)
ShowMessage:Fire(message,result)
if result then
RefreshInventory:Fire()
statWindowOpened = false
newFrame:Destroy()
end
end)
newFrame.Equip.MouseEnter:Connect(function()
HoverSound:Play()
end)
I need Delete() newFrame when a new newFrame appear
In that case, the old newFrame go "buttom" the new newFrame
How i can delete the old newFrame?
