ok so my issue is im finding the highest number in my table and that is working fine but once the script iterates again the old values are still there obviously, so i have to delete them but for some reason i cant figure out how and i have tried 2 methods the first was using table.remove and the second was deleting key by key
Script:
local Screens = script.Parent.MapVotingScreens:GetChildren() local AlsoScreens = script.Parent.MapVotingScreens:GetDescendants() local highest = 0 local nums = {} while wait(.5) do for x,y in pairs(Screens) do local Votes = y.Votes table.insert(nums,Votes.Value) for i,v in pairs(nums)do if v > highest then highest = v for k,d in pairs(AlsoScreens) do if d:IsA("SelectionBox") then d.Visible = false end end y.SelectionBox.Visible = true end end nums[x] = nil --table.remove(nums,x) end end
There's 1 way I thought of doing this as well.
1) Find the position of each value in the table and remove it.
Method 1
local nums = {} for _,val in pairs(nums) do local posVal = table.find(nums,val) wait(0.1) table.remove(nums,val) end
This will iterate through the table and find the position of each value in the table and remove it.
I'm pretty sure both of these works. But, if this helped don't forget to select this as the answer!