I want to save the time in the game and this script is not working. I have turned on API Services. Code:
local ds = game:GetService("DataStoreService")
local data = ds:GetDataStore("ClockTime")
game.Players.PlayerAdded:Connect(function(p)
local success, err = pcall(function()
game.Lighting.ClockTime = data:GetAsync(p.UserId)
end)
if success then
print("yay")
end
if err then
print("err: "..err)
end
end)
game.Players.PlayerRemoving:Connect(function(p)
local success, err = pcall(function()
data:SetAsync(p.UserId, game.Lighting.ClockTime)
end)
if success then
print("yay")
end
if err then
print("err: "..err)
end
end)
When I am doing this in game, it just sets it to the time in the game and not the DataStore save.
Thanks, b_mni.

2 comments
ok i will try that. BUT: how am I supposed to do that. By the way, it's 1 player servers
perfect I will experiment with it more to my likings.