Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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()

This discussion is preserved as it was. New answers, comments, and votes are closed.