I need to keep the characteristics of the monster, such as: how often it revives, how often it hits, at what distance it notices you, etc. Question, where can I store this data?
I found three options: ModuleScript, ServerStorage, Replicated Storage
But I don’t know which one is the best and most convenient + optimized.
Can you answer the question please? I will be glad if you can suggest more options where to store data, and also explain how to save everything there, if it is a module script then explain a little how it works, thanks.
You should consider using attributes. Very easy to use and understand.
Instance:GetAttribute(attributename); -- gets the value of the attribute from an instance
Instance:SetAttribute(attributename, value); -- set an attribute with the specified value on an instance
You can also set attributes directly in the properties menu, you find them at the bottom. You could assign, for example, a damage attribute on Studio, then in the script where you manage the monster’s damage, you can just call :GetAttribute() on the monster and it’ll give you the value you set beforehand.
In the property tab of Studio, at the bottom, you can find the “Attributes” section. Just add them onto your monster and use :GetAttribute to retrieve them whenever you need them
It’s a simple module that just returns a dictionary containing the monsters’ names and another dictionary that contains all their stats. To retrieve this dictionary:
local MonsterStats = require(PathToTheModule);
print(MonsterStats["Monster1"].Health); -- this would print 500