So recently after a new Roblox Update all of my datastores in all of my games that uses them keeps returning “Unable to cast value to object” and I’ve spent 5 hours trying to fix this but I think it’s a Roblox issue.
Code I usually use for loading DataStores and saving them (Even this is spitting out the same error)
local MainData = game:GetService("DataStoreService"):GetDataStore("LSData")
local Littlebuck = 0
game.Players.PlayerAdded:Connect(function(player)
wait(0.1)
local Success, Result = pcall(function()
return MainData:GetAsync(tostring(player.UserId),"LSData")
end)
if Success then
if Result then
if Result.Littlebucks then -- LITTLEBUCKS
print(Result.Littlebucks)
else
Littlebuck = 1000
end
else
Littlebuck = 1000
end
end
if not Success then
print(Result.. " data store")
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Success, Result = pcall(function()
return MainData:GetAsync(tostring(player.UserId),"LSData")
end)
if Success then
MainData:SetAsync(player.UserId, {
Littlebucks = Littlebuck,
})
wait(0.1)
end
if not Success then
print(Result)
end
end)
Errors in all of my games is the same all of a sudden.
Anyone else experiencing this? Usually constantly happens in-game and not in Roblox Studio.