this is nitpicky so don’t feel like its some grand problem or anything
- the
:
on all of your module functions is redundant. its a function, not a method, so it needs to be a .
. methods provide the self
argument, which isn’t used here and thus can be confusing to another coder. also theres a typo, as Livid pointed out.
- storing the entire Service of game.ReplicatedStorage in
MasterRaceTable
seems kinda redundant, especially if youre not gonna let it cache with :GetService()
by indexing it so many times. make it a variable.
- start using some typechecking to help yourself and other programmers. things like
function SpawnHandler:SpawnCharacter(player, datatable, Character)
can be
function SpawnHandler:SpawnCharacter(player : Player, datatable : {[number] : any}, Character : Model)
so you can know what its supposed to be. especially with datatable, which is inherently confusing from an outside perspective as to what it is and whats inside it and what those things are supposed to be.
4.
if success and Data then
LivePlayerData[UUID]["CharacterData"]["MaleName"] = Data.MaleName
LivePlayerData[UUID]["CharacterData"]["FemaleName"] = Data.FemaleName
LivePlayerData[UUID]["CharacterData"]["GuildName"] = Data.GuildName
LivePlayerData[UUID]["CharacterData"]["Currency"] = Data.Currency
LivePlayerData[UUID]["CharacterData"]["Health"] = Data.Health
LivePlayerData[UUID]["CharacterData"]["Lives"] = Data.Lives
LivePlayerData[UUID]["CharacterData"]["Alignment"] = Data.Alignment
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["ManaSpeed"] = Data.ManaAbilities_ManaSpeed
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["ManaRun"] = Data.ManaAbilities_ManaRun
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["ManaClimb"] = Data.ManaAbilities_ManaClimb
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["ManaClimbSpeed"] = Data.ManaAbilities_ManaClimbSpeed
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["ManaPunch"] = Data.ManaAbilities_ManaPunch
LivePlayerData[UUID]["CharacterData"]["ManaAbilities"]["HasMana"] = Data.ManaAbilities_HasMana
LivePlayerData[UUID]["CharacterData"]["Race"]["RaceType"] = Data.Race_RaceType
LivePlayerData[UUID]["CharacterData"]["Race"]["RaceVar"] = Data.Race_RaceVar
LivePlayerData[UUID]["CharacterData"]["SpawnData"]["SpawnPoint"] = Data.SpawnPoint
LivePlayerData[UUID]["CharacterData"]["SpawnData"]["SavedPosition"] = Data.SpawnPosition
else
warn(player.Name.. " HAS NO DATA! / DATA DD NOT SAVE! ( NEW USER? )", err)
end
you should differentiate your warning/failsafe detection between “they dont have data” versus “the datastore service is literally down and we’re hopeless”, kind of a big difference
5. stop calling player.UserId
‘UUID’, that is not the same thing, that term has a meaning and its even generatable in Roblox via HttpService.
6. make your own constructor for stuff like this, mainly because its ugly, also its pointless to define an index as nil.
ActionBarData = {Slot1 = nil, Slot2 = nil, Slot3 = nil, Slot4 = nil, Slot5 = nil, Slot6 = nil, Slot7 = nil, Slot8 = nil, Slot9 = nil, Slot10 = nil, Slot11 = nil}
as in like
local function construct(max : number, value : any): {[number] : any}
local t = {}
for i = 1, max do
t["Slot" .. tostring(i)] = value
end
return t
end
ActionBarData = construct(11, false) -- sets every value to false