I’m making a state system and sometimes there is multiple actions and I would like to have those deleted. I don’t really know how I would do that though.
1 Like
Values from what? In a table?
123123
local TableAntiClone = {}
for i,v in AllValues do
if TableAntiClone[v.Name] then
v:Destroy()
else
TableAntiClone[v.Name] = true
end
end
something like this
I assume your talking about instances, like ObjectValues or IntValues. Here’s what I would do;
local actionsFolder -- this should be the instance in which all actions are parented to.
local currentAction -- this variable should be the instance you don't want to delete
for _, v in pairs(actionsFolder:GetChildren()) do
if v ~= currentAction then
continue -- skips the rest of the code and continues the loop
end
v:Destroy()
end
Since very little was described I can’t help out much. If this isnt the solution you after, I suggest you elaborate more so I understand what to look do.