i made the weirdest datastore i could think of to improve my datastore but it's giving no signal like it didn't print; "Data succesfully saved", neither the errormessage???

local ds = game:GetService("DataStoreService")
local myds = ds:GetDataStore("myds")

local Messages = {}

game.Players.PlayerAdded:Connect(function(plr)
	
plr.Chatted:Connect(function(msg)
	table.insert(Messages, msg)
end)
	
pcall(function()
local RetrievedData = myds:GetAsync("Player_"..plr.UserId)
if RetrievedData then
	
	for _, v in pairs(RetrievedData) do
		print(v)
		
		end
	end
end)	
end)

game.Players.PlayerRemoving:Connect(function(plr)
	
	local sucess, errormessage = pcall(function()
		myds:SetAsync("Player_"..plr.UserId, Messages)
		
	end)
	
	if sucess then
		print("Data saved succesfully")
	else
		print("not saved. But that doesn't mean I'm bad! :)")
	end
end)

2 comments

0

can you try replacing the lasat if with a print(errormessage)?

0

sure