I tried. However the code errors when I use the same exact lines as you.
Could you provide more details regarding the errors that youâre getting?
Yes, I will get back to you when Iâm back home.
the error i received was ERR_REQUIRE_ESM
You are using import
in a project that uses require
. You can add change the file extension from "type": "module"
to your package.json
file and.js
to .mjs
, and before you run it make sure to change the file extension in the package.json
as well.
I also tried converting the type to module. However, how would I change the file type to .mjs? Just the main file and nothing else? The JSON files stay the same right?
Yes, just .js
files should have their file extension changed to .mjs
.
How would I go about getting keys that are numbers? I get an error saying the key must be a string.
Update: I got it somehow to work with a string that was a number. Interesting
Datastore keys must always be a string, if you want to use a number then convert it to string. I am assuming that you already figured it out based on your update.
This isnât correct, you do not need to mark the entire project as a module in order to execute import statements. Simply change the file extension from js (JavaScript) to mjs (modular JavaScript).
I believe they changed the behavior recently. Marking the entire thing as a module makes you unable to use require in all scripts unless you create a custom require function using import.
My apologies, thanks for correcting me. I also mentioned it because I highly recommend that people use ES6 modules especially if theyâre starting out a new project, this is because theyâre much simpler and newer than the outdated old school require
and module.exports
.
How would I fix this error?
Update: fixed my issue again, turns out I had two lines misplaced with each other. New to JS
Does this work with OrderedDataStore?
Not yet, I have not added support for OrderedDataStore.
that is a bummer, I was using RbxCloud before switching to this module, the creator of it informed us that if we want to use OrderedDataStore, we should switch to this oneâŚ
is there any estimates when you will be adding support for OrderedDataStore?
I will try to get it out by next weekend.
That would be amazing if you could bring it by next weekend! thanks!
did you update your module to support OrderedDataStore?
It was delayed, I will try to get it done within 3 days.
Really looking forward to it, thank you!