Datastore does not load player data properly.
When called from the command line, I receive the correct data.
However, if called from anywhere else (Script in ServerScriptService), it returns nil.
I’ve tried this in game and in Studio, but it does the exact same thing.
Code used for getting data:
local DS = game:GetService('DataStoreService');
local PlayerData = DataStoreService:GetDataStore('T-PlayerData');
print(PlayerData:GetAsync(Player.UserId))
local DS = game:GetService('DataStoreService');
local PlayerData = DataStoreService:GetDataStore('T-PlayerData');
print(PlayerData:GetAsync(Player.UserId))
This is the only piece of code you provided us and just looking at only this it should error because “Player” is not defined anywhere.
The server might run before the player is added, try using local Player = game.Players:WaitForChild("Kr1szhy") instead, I also recommend getting the datastore on game.Players.PlayerAdded:Connect(function(Player)) so that It applies to all players that joins
I don’t know your code, and your probably right, but just in case you didn’t know, a datastore will always return nil if there is no data saved to it. Just thought it might be important to mention.