When I click on a frame I am marking the item in the table in the server
when I click on confirm i should remove all the item i marked from the table
if i select 1 frame and click on confirm it works
if i select 2 or more frames and click on confirm it only removes the last one i selected
client (click frame)
ItemFrame.ItemButton.MouseButton1Click:Connect(function()
if script.Parent.Visible == true then
if ItemFrame.SelectedForSell.Value == false then
ItemFrame.SelectedForSell.Value = true
MarkItemToSellRemote:FireServer(itemData, true)
else
ItemFrame.SelectedForSell.Value = false
MarkItemToSellRemote:FireServer(itemData, false)
end
end
end)
server (when client click frame)
ReplicatedStorage.SellSystem.MarkItemToSell.OnServerEvent:Connect(function(player, itemData, markToSell)
local profile = Manager.Profiles[player]
if not profile then return end
for _, item in profile.Data.Inventory do
if item.ID == itemData.ID then
print(profile.Data.Inventory[_].ID)
profile.Data.Inventory[_].SelectToSell = markToSell
end
end
end)