I have a module script located in starterplayerscripts, which stores a local variable for a value I use.
However, whenever I print it in any other local script even after requiring it, the table inside it is empty when it shouldn’t be.
I gave it a value when the server starts and when the server prints it the values show up, but on the local it’s just an empty table. I have no idea what’s going on.
-- Local Module in Starterplayerscripts --
local LSModule = {}
-- Holds all local data for player for future use
LSModule.DataStore = {}
LSModule.DataStore = {Stamina = nil, MaxStamina = nil}
return LSModule
-- Server script that sets the value of it --
local UserID = Player.UserId
if LocalStorageModule.DataStore.Stamina == nil then
LocalStorageModule.DataStore.Stamina = PlayerData.PlayerDataStore[UserID].Stamina
print(LocalStorageModule.DataStore.Stamina)
end
if LocalStorageModule.DataStore.MaxStamina == nil then
LocalStorageModule.DataStore.MaxStamina = PlayerData.PlayerDataStore[UserID].MaxStamina
print(LocalStorageModule)
end