The name of the frame matches, but it won't be deleted, And it overlaps. Please help


What I planned was that whenever I opened the gui,
the original list would be deleted and a new list would be created.

However, the frames were not deleted even though the names of the frames matched,
and also the frames kept overlapping each time I opened the gui.
I didn’t escape from this bug all day.

I lost my mind. Please help…

List Code:

local auras = require(game:GetService("ReplicatedStorage"):WaitForChild("Auras")) --this is the module script that contains the aura data
local auraArr = auras.AuraData
local auraScrollingFrame = script.Parent.Frame.OwnAurasScrollingFrame
local EquipAura = ReplicatedStorage:WaitForChild("AuraShopEvents").EquipAura
local AuraFrame = script.AuraFrame -- this is the frame that will be cloned


function createFrame(auraNo)
	local newFrame = script:WaitForChild("AuraFrame"):Clone()
	newFrame.Parent = auraScrollingFrame
	
	local originalSize = newFrame.Frame.Size
	
	

	newFrame.Frame.TextLabel.Text = auras[auraNo].AuraName


	newFrame.Frame.UIGradient.Color = ColorSequence.new {
		ColorSequenceKeypoint.new(0, auras[auraNo].Color1),
		ColorSequenceKeypoint.new(1, auras[auraNo].Color2),
	}

	newFrame.Frame.TextButton.MouseButton1Click:Connect(function()
		newFrame.Frame.Size = UDim2.new(originalSize.X.Scale * 1.1, originalSize.X.Offset * 1.1, originalSize.Y.Scale * 1.1, originalSize.Y.Offset * 1.1)
		wait(0.1)
		newFrame.Frame.Size = originalSize
		EquipAura:FireServer(auraNo)
	end)
end


function clearList()
	for _, item in pairs(auraScrollingFrame:GetChildren()) do
		if item:IsA("AuraFrame") then
			item:Destroy()
		end
	end
end

RETextGui.OnClientEvent:Connect(function(value, auraArr) --auraArr is the array of auras
	insert_gui.Visible = true
	changingValue = value
	fillList(auraArr)
end)

function fillList(auraArr)
	clearList()
	for i, _ in pairs(auraArr) do
		local new = AuraFrame:Clone()
		local originalSize = new.Frame.Size
		new.Frame.TextLabel.Text = auras[i].AuraName


		new.Frame.UIGradient.Color = ColorSequence.new {
			ColorSequenceKeypoint.new(0, auras[i].Color1),
			ColorSequenceKeypoint.new(1, auras[i].Color2),
		}

		new.Frame.TextButton.MouseButton1Click:Connect(function()
			new.Frame.Size = UDim2.new(originalSize.X.Scale * 1.1, originalSize.X.Offset * 1.1, originalSize.Y.Scale * 1.1, originalSize.Y.Offset * 1.1)
			wait(0.1)
			new.Frame.Size = originalSize
			EquipAura:FireServer(i)
		end)
				
		new.Parent = auraScrollingFrame
	end
	--playerList.CanvasSize = UDim2.new(0, 0, 0, playerList.UIListLayout.AbsoluteContentSize.Y)
end

Also if what I said is too confusing then just ask for clarification and I’ll try to help.

I don’t see anywhere in this script where you are deleting frames with matching names

I might be wrong, but i don’t think

if item:IsA("AuraFrame")

would work, instead try using

if item.Name == AuraFrame.Name
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.