#How would I remove a string from a Dictionary inside another Dictionary

1 messages · Page 1 of 1 (latest)

misty chasm
#

Or its just a table idk the difference that much

#

Like ts

local Tuff = {}
Tuff.a = {"apple", "banana"}
Tuff.b = {"apple", "banana"}```
undone fern
#

do u mean like how to remove colour

misty chasm
#

wait

#

how would I remove apple from Tuff.a

misty chasm
undone fern
#

or you can use a loop

misty chasm
undone fern
misty chasm
#

or is that wrong

undone fern
#
for i, v in Tuff.a do
    if v == "apple" then
        table.remove(Tuff.a, i)
    end
end
misty chasm
undone fern
#

it work for me on studio


local Tuff = {}
Tuff.a = {"apple", "banana"}
Tuff.b = {"apple", "banana"}


for i, v in (Tuff.a) do
    if v == "apple" then
        table.remove(Tuff.a, i)
    end
end
misty chasm
#

alright I'll send you my actual script

#
local Remote = game.ReplicatedStorage:WaitForChild("VoteRemote")

local Poll = {}
Poll.Single = {}
Poll.Double = {}

Remote.OnServerEvent:Connect(function(plr, Vote)
    if Vote == "Single" then
        Poll.Single = plr.Name
        for i, v in Poll.Single do
            if v == plr.Name then
                table.remove(Poll.Single, i)
            end
        end
        print(Poll)
    elseif Vote == "Double" then
        Poll.Double = plr.Name
        for i, v in Poll.Single do
            if v == plr.Name then
                table.remove(Poll.Single, i)
            end
        end
        print(Poll)
    end
end)```
I don't think this is the most efficient way to do a poll but I'd want to do it myself
undone fern
#

whats the exact error

misty chasm
#

ServerScriptService.Voting:18: attempt to iterate over a string value - Server -

undone fern
#

not an array that that the for loop can use