#Is this secure and good?
1 messages · Page 1 of 1 (latest)
It is safe
finally someone
Efficiency I have no idea, but you're basically storing a table of information globally instead of in one script
alr
Of course you can also make a module script have util functions too
what is the point of that
Instead of let's say 4 separate scripts having their own saving, loading, ect logic, you just have one DataStoreModule that does that for you, those scripts will just have to call those functions themselves
Another useful example:
You won't need to have a script that handles the player leaving and joining, that can also be handled in the module script
thats all done on one datastoreservice script
they just recall it from this dictionary
That's bad
why
I'd personally separate the modules into categories
re-usablity and code cleanliness
the datastore getasyncs the data
and puts it in this modulescript
and each script takes what they need
Example of my Forwards-And-Backwards-Inverse-Kinematics module.
The main module, works as a loader basically, it connect the smaller modules, which in my case are "Segment" and "Chain", making the different parts easy to modify.
its like 1 line of code to recall it
I am just telling you good practices, especially for someone with an s1
hmm
so like under a modulescript
theres more modulescripts
Pretty much yeah
this modulescript
It would let you edit different parts of your logic without cluter
Okay, gimmie a sec, I'll show you an example of how I would personally handle DataStoring in my games
clutter reminds me of clutterfunk
smh
I already have this system implemented
im just seeing if its actually as secure and efficient as I think
There isn't much of a security risk
Since modules aren't replicated across server-client
This is what profile service does
If that's a someone-else made module
Profile service is pretty good
Get out of here
If you're gonna get spoon-fed other's people work, you'll never improve
I am trying to teach him here and you come and just say "Use someone else's work"
Sorry but I don’t have the knowledge to make such a good data system but I also don’t want it to hold me back from game dev
It's fine, but not the current point of this convo
I’m not telling him to use profile service
I just said that’s what profile service does
ive heard of profileserver but was too lazy to research it
It’s very reliable
bc datastoreservice was already known to me
From what I heard
continue.
The main reason to use something like profile service is session locking
But I looks at profile service code and there’s so much other shit
Which is there for good reason most likely
is that like
And idk how todo all that stuff
the spr library module
So I just use the module
@wet island Also, here's what my approach would basically look like:
DataStore is the main module that holds the data and has utility methods of "getPlayerValue(plr, category, value)" for example or "getPlayerCategory(plr, category)"
but
why make a function
when you can recall it from a dictionary
What if there’s more than 1 nested table
In a table
it's cleaner and there may be a moment where there isn't an object in that spot of the dictionary.
Do u have session locking in this
If not then u can lose data
hm
what is session locking
like bindatclose
or whatever its called
No
Since it's easier to:
local data = module:GetPlayerData()
if not data then return end
rather than
local data = module[categoryName][valueName]
if not data then return end
it makes your code cleaner and what not
If player leaves server and data is in middle of being saved but before data is done being saved player is already in another server so the previous data is loaded
true
It doesn't let players change their data if it's still being saved pretty much
I can see that
I think session locking kicks the player if their data is in middle of being saved after they left on another server
That’s what it does for profile service at least
There are numbers of different ways to do it
Some wait for the data to be saved before loading it, others kick the player
what's the stuff under it
self-explanatory?
I never rly had to worry about data since I began using profile service a while ago so if u want to save urself a headache id suggest that but if u wanna be innovative and not be “spoon-fed” code feel free to make ur own stuff
Basically if data isn't there it doesn't do anything
I make games for fun
Profiles module would handle each individual profile of a player.
Saving would well... handle saving. Such as making sure data is saved.
Loading would make sure the data from another server has saved before loading it
and a serverscript would handle the saving and loading?
No
They'll only get data of the players.
Or set it
Though you still would need 1 ServerScript to "Turn On" the module
ill implement the modulescript to be functions
For example:
The leaderboard script's playerAdded event could look like this:
local playerData = module:getPlayerCategory(player, "leaderboard") --in a get method, you could add a wait of sorts so that this script waits for the data to load.
if not playerData return end --Player doesn't have data.
--Do stuff
ah
isn't modulescripts used when a function is used more than once
getting/saving data is only like once
Yes\
no
If you want clean scripts, then no, getting/saving data isn't done once
😨
Which is why you'd want a module script to do that
since a clean script only does what it needs to do
so
and having a script that you need to constantly update with new player data isn't a clean script
Very roughly said, yes.
scary stuff
Modularity is very important in high-levels
Since it's easier to look through 300-ish lines of code in a module script than 2k-ish lines of code in a normal script to debug
That one would require context
highest i have is 550
Since if you're making let's say an IK script, yes, everything will be a module, since IK isn't something that would usually be done for 1 script
the hell is ik
Inverse Kinematics
ah
That was an extreme example, I'll admit but it's still accurate
Since let's say I made an AI with 7 states and I am having issue with only 1 of those states.
Would it be easier for me to look through hundreds of lines of code, jumping between the very top and the very bottom to find the issue or just look through the lines of code that only handle that one specifc state?
this is what im doing
Why are the functions in an if statement 
and imo, you could separate them into a utility module
bc there are 4 cases
equipping/unequipping
adding an item
removing an item
and moving around items in the inventory
I wanted them to be together
That's the point you make them a module
Since code usually follows a structure of
Variables > Functions > Connections
And if you want them to be grouped together, you can just make them a module.
Though that would still need context if you should or not
I don't get the point of this being a module
Maybe use a table in a module that saves it to a profile store, so you when you need it the module auto updates it, I could be stupid but that’s my take
Grouping the code?
dang everyone loves profileservice
Because they're scared of data storing
Or datastore, idc
datastoring is scary
It’s not that hard idk why people don’t like it
Save and upload, google, cry, discover you were stupid then fix and repeat
People prefer to be spoon-fed stuff rather than work for it.
Datastore workflow guys
I work for it cuz I only can read my own code
Cuz I’m bad like that
@wet island Actually, I remember one of my first attempts at data-storing and I used several bad practices, I'll show you
ok
Not minding the "LoadPasses" function, I've basically repeated the same code 3 times.
my initial idea was
Which I could of easily made into a module system like I shown an example before
Setting once is questionable
I prefer to have a auto-save every 2 minutes?
im doing 100seconds
If you want, you can add me if you're 17 and up, otherwise just a simple dm when you have a question will suffice
I am in fact not 17 and up
And to remind you of the answer:
Yes, it is secure and most of the time it's good enough.
yay
But for cases like the default roblox leaderboard, you'd need the Leaderboard script to update the values in the leaderstats and the dictionary at the same time.
datastoreservice
I do not use default
I like things done all by me
auto-saving
It's literally just a folder named "leaderstats" parented to the player with a few values inside.
yeah I used it when I was starting
Dude
?
what the fuck are you doing with coroutine.resume(coroutine.create)
its a coroutine
I'm not that good with them
You can just use task.spawn()
Since I assume you're doing it so that it wouldn't block code that comes after it.
ah
good luck gang
Yall still here
O
post closed