Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How i can delete newFrame and replacing it with a new newFrame?

Asked by 4 years ago
Edited 4 years ago

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?

1 answer

Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
4 years ago
local newFrame = FinalTemplate:Clone()

Now, make a second but clone it right before removing the first

local newFrame2 = FinalTemplate:Clone()

Then Destroy() the Frame

newFrame:Destroy()

Ad

Answer this question