Server script running in Workspace, and it's not disabled. I try it on a test server and in studio and it won't output anything.
print("sup")
I'm not sure how this affects it, but I'm new to data stores, and I tried making a server script running in Players that says whether or not my stuff loads when I join. It didn't work in studio or in the test server, so I moved it to Workspace. For whatever reason, it kinda worked and kinda didn't ("sup" and "Loading Player's data" printed, nothing else happened). Nothing worked in the test server. Here's the script.
print("sup") local datastores = game:GetService("DataStoreService") local users = datastores:GetDataStore("Users") local http = game:GetService("HttpService") local default = { ["AdminStatus"] = "Noob", --Administrative status, such as "Noob", "Mod", "Admin", etc ["Level"] = 1, ["Money"] = 50 } local JCodedDefault = http:JSONEncode(default) game.Players.PlayerAdded:connect(function(player) print("Loading "..player.Name.."'s data.") player:WaitForDataReady() local playerData = users:GetAsync("user_"..player.userId) if playerData then print(player.Name.."'s data was found.") else print(player.Name.."'s data was not found.") users:SetAsync("user_"..player.userId, JCodedDefault) end end)
print("sup") local datastores = game:GetService("DataStoreService") local users = datastores:GetDataStore("Users") local http = game:GetService("HttpService") local default = { ["AdminStatus"] = "Noob", --Administrative status, such as "Noob", "Mod", "Admin", etc ["Level"] = 1, ["Money"] = 50 } local JCodedDefault = http:JSONEncode(default) game.Players.PlayerAdded:connect(function(player) print("Loading "..player.Name.."'s data.") --player:WaitForDataReady() You DONT need to wait for data to be ready in datastores local playerData = users:GetAsync("user_"..player.userId) if playerData then print(player.Name.."'s data was found.") else print(player.Name.."'s data was not found.") users:SetAsync("user_"..player.userId, JCodedDefault) end end)
In test servers you need to activate studio api for the place in order to use datastores.