What do you want to achieve? Keep it simple and clear!
I wanna make gangs system, but i don’t know how
What is the issue? Include screenshots / videos if possible!
No ideas lol
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked on youtube, dev hub, but i didn’t find anything good tutorial
I’d say the best way should be to simply make a team and add the players that join the gang to that team. As for creating the gang, a simple remote event like so:
event.OnServerEvent:Connect(function(plr, othervariables)
if not plr.Team then --make sure they're not in a gang
--create the gang
end
end)
Nah it’s not just like i need a more better system. Like gangs leaderboards(by player amount), gangs which save(datastore), creating a gang(like there will be leader of gang), upgrading gang and etc. Not just team
Oh, sorry, I misunderstood. I would save the gang’s player amount through an ordered datastore and save what gang the player is in through a normal datastore you should probably also save a table of the id’s inside of that gang inside of a normal datastore. You would be able to get the top gangs by number of players inside of it through the ordered datastore.
As I said, for the gang creation, you should probably use a remote event, and for upgrades, save the upgrades used inside of the gang’s data table. The table should probably look something like this:
You don’t need to create a folder for it, just insert every created gang’s name into a table and save it in a data store.
local dss = game:GetService("DataStoreService")
local gangds = dss:GetDataStore("GangNames")
local gangs = {"gang1","gang2"}
gangds:SetAsync("key", gangs)
then you could simply retrieve it by
local dss = game:GetService("DataStoreService")
local gangds = dss:GetDataStore("GangNames")
print(gangds:GetAsync("key"))
This is a script, you can only access datastores through scripts. If you want to get it on the client, use a remote function, invoke the server, and have the server return the gangs.
So this is my script where i should get when player create gang
local GangCEvent = game.Workspace.GangsEvents.GangCEvent
local dss = game:GetService("DataStoreService")
local gangds = dss:GetDataStore("GangNames")
GangCEvent.OnServerEvent:Connect(function()
print(gangds:GetAsync("key"))
end)