rtvr56565
(rtvr56565)
February 19, 2021, 7:40pm
1
I made this script
ServerScriptService - Normal Script
local DataStore = game:GetService("DataStoreService")
local DS1 = DataStore:GetDataStore("DS1")
game.Players.PlayerAdded:Connect(function(player)
DS1:SetAsync(player.UserId, "text")
end)
but isn’t working, when i try see the DataStore, i don’t have anything in DS1, its empty
I would recommend using pcalls to prevent it from bugging out.
local DataStore = game:GetService("DataStoreService")
local DS1 = DataStore:GetDataStore("DS1")
game.Players.PlayerAdded:Connect(function(player)
local success, fail = pcall(function()
DS1:SetAsync(player.UserId, "text")
end)
end)
Also, make sure if you’re testing in studio that API Services are enabled.
1 Like
local DataStore = game:GetService("DataStoreService")
local DS1 = DataStore:GetDataStore("DS1")
game.Players.PlayerAdded:Connect(function(player)
local success,err = pcall(function()
DS1:SetAsync(player.UserId, "text")
end)
if not success then
warn("Couldn't save data")
end)
1 Like
rtvr56565
(rtvr56565)
February 19, 2021, 8:11pm
4
you forget a “end” in the script
Oh, my bad. Did it work though?
1 Like
rtvr56565
(rtvr56565)
February 19, 2021, 8:18pm
6
wait pls, im testing if the script works
rtvr56565
(rtvr56565)
February 19, 2021, 8:23pm
7
No, but i dont understand, i used in other game and worked…
Idk why my new game cant run the script (i used prints and warns and nothing in output)