Hello everyone, so I’m making this radio system and I made it so that when there are 12 messages in a scrollingframe the first message with the selection order “1” gets deleted. But instead of the textlabel with the “1” selection order getting deleted the most recent one and the one that needs to be deleted is getting removed. This will make the radio unusable, thank you for reading, and thank you for any help!
Here is the code I use for removing the textlabel:
TransmitRemote.OnClientEvent:Connect(function(msg, target)
print("Yes!")
local Count = #script.Parent.Main.RadioCalls:GetChildren() - 2 -- -1 because of uilist layout and template.
if Count >= 12 then
for i,v in pairs(script.Parent.Main.RadioCalls:GetChildren()) do
if v.Name ~= "UIListLayout" and v.Name ~= "RADIO_MESSAGE" then
if v.SelectionOrder == 1 then
v:Destroy()
for a,b in pairs(script.Parent.Main.RadioCalls:GetChildren()) do
if b.Name ~= "UIListLayout" and b.Name ~= "RADIO_MESSAGE" then
b.SelectionOrder -= 1
end
end
return
end
end
end
end