my script is for people to make gangs and if theres no gang with the group id already made then it will add the group id onto a datastore so in the future the same gang with same group id wont be created but right now when you make a gang it dosnt seem to be adding a new value in the datastore. this is my first time using updateasync as i usually use datastore2 but i have reverted back to this lol
GangCreate.OnServerEvent:Connect(function(player,gangid)
if player:IsInGroup(gangid) then -- see if palyer is in group
if player:GetRankInGroup(gangid) == 255 then -- see if player is owner
if AllGangData:GetAsync("Gangs1") == nil then
AllGangData:SetAsync("Gangs1",10161876)
end
AllGangData:UpdateAsync("Gangs1",function(olddata)
local CurrentGangs = {olddata}
print(table.unpack(CurrentGangs))
if table.find(CurrentGangs,gangid) then
print("gang with same group id is already made")
return nil
else
print("made gang")
table.insert(CurrentGangs,gangid)
return CurrentGangs
end
end)
else
ErrorModule.Function(player,"You Are not the owner of the group")
end
else
ErrorModule.Function(player,"You Are not in the group")
end
end)