I'm making an admin system that you basically type a players name in then it will load a list of their data into a gui and from there you can edit it.
Now I save the players data in a table, and that seems to cause a problem when I try loading stuff in.
Here's the server script:
local DataStore = game:GetService("DataStoreService"):GetDataStore("t-t-t2")
game.ReplicatedStorage.AdminFunction.OnServerEvent:Connect(function(plr, target)
print("it got here?")
local id = game.Players:GetUserIdFromNameAsync(target) --The id is our key
local key = "stats-"..id
print(key)
local data = DataStore:GetAsync(key)
print(data)
end)
and here's the local script:
script.Parent.MouseButton1Click:Connect(function()
local isAdmin = game.ReplicatedStorage.IsAdmin:InvokeServer(game.Players.LocalPlayer.Name)
local targetPlayer = script.Parent.Parent.PlayerName
if isAdmin == true then
print("ok")
game.ReplicatedStorage.AdminFunction:FireServer(targetPlayer.Text) --Firing the name to the server dumbass
end
end)

2 comments
Hey, sorry for late reply, but the Data is returned as nil. Thanks for your help though. Could you possibly get back to me?
Is if is nil, then it maybe because the player does not have any data saved yet.