So with the script I have, Im in theory removing the selected item from a table which means it can’t be chosen again but its being chosen again.
local function chooseLoc(Location)
local locations = {
"Loc1",
"Loc2",
"Loc3",
"Loc4",
}
local index = math.random(#locations)
local gender = locations[index]
table.remove(locations,index)
return gender
end
local function SpawnCustomer()
if Capacity.Value >= 1 then
local currentCustomer = Customers:Clone()
currentCustomer.ChosenFood.Value = chooseItem()
local Path = SimplePath.new(currentCustomer)
local loca = chooseLoc()
print(loca)
print(chooseItem())
currentCustomer.Parent = game.Workspace
currentCustomer:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.CustomerSpawners.Spawn1.CFrame
Capacity.Value = Capacity.Value - 1
Path:Run(game.Workspace[loca])
Path.Blocked:Connect(function()
Path:Run(game.Workspace[loca])
end)
Path.Error:Connect(function(errorType)
Path:Run(game.Workspace[loca])
end)
end
end
Thanks