(This block of code is a small segment of my datastore, if you need more of the code, ask me.)

	local id = plr.UserId
	local datasuccess, datamsg = pcall(function()
		plyrid = dsso:GetAsync(plr.UserId)
	end)
	char = dsso:GetAsync("char", nil)
	checkout = dsso:GetAsync("checkout", nil)

	game.ReplicatedStorage.WipeEvent.OnServerEvent:connect(function()
		print("Resetting data...")
		--[ALL DATA RESETS]
		if datasuccess then
			dsso:SetAsync("char", {})
			char[1] = tostring(plyrmodel["Left Arm"].Color)
			char[2] = tostring(plyrmodel["Right Arm"].Color)
			char[3] = tostring(plyrmodel["Left Leg"].Color)
			char[4] = tostring(plyrmodel["Right Leg"].Color)
			char[5] = tostring(plyrmodel["Torso"].Color)
			char[6] = tostring(plyrmodel["Head"].Color)
			
			print("Data reset!")
		end
	end)
	
	game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
		dsso:SetAsync(plr, char)
		dsso:SetAsync("checkout", id)
	end)
	
	game.ReplicatedStorage.LoadEvent.OnServerEvent:Connect(function()
		print("Attempting to load data to client side...")
		if datasuccess then
			dsso:GetAsync(plr, char)
			if char ~= nil and dsso:GetAsync("checkout") ~= nil then
				print("Data found, loading...")
				game.ReplicatedStorage.GenEvent:FireClient(plr)
			else
				print("No data found! Returning error screen...")
				game.ReplicatedStorage.FailEvent:FireClient(plr)
			end

The LoadEvent would only fire the GenEvent if the checkout variable was not nil, and would in theory only work if the RemoteEvent had been triggered before the LoadEvent to set it's value to the player's ID, and then saved that value in the datastore. But when I try to load the game with no previous data saved, it works for some reason and makes data out of nowhere, which I do not want. What's going on?

1 comment

0

Can you not delete your questions just to report it.