So I made this script that should set a value inside of a table called Accepted. And also a value that is Items. Only problem is it doesnt work AT ALL.
It doesnt change the accepted value, nor does it change the items in the table. WHy???
local connect = TradeUpdate.OnServerEvent:Connect(function(plr,trade,Update,other)
print('Trade update received: '..Update)
if trades[trade.Plr1.Plr.Name..'_'..trade.Plr2.Plr.Name] then
local play = nil
if trade.Plr1.Plr == plr then
play = trade.Plr1
else
play = trade.Plr2
end
print(play)
if Update == 1 then -- declined
trades[trade] = nil
TradeUpdate:FireClient(player,nil)
TradeUpdate:FireClient(user,nil)
elseif Update == 2 then -- accepted
print(play.Accepted)
play.Accepted = not play.Accepted
elseif Update == 3 then
if other then
play.Items = {table.unpack(play.Items), table.unpack(other)}
print(trade)
end
end
else
print('Trade doesnt exist')
end
end)