DataStore script crashing the game after booting up

So I finally managed to create a datastore that would write values, problem is it doesn’t work on Client. On Studio, it runs perfect but the data doesn’t load. I have tried changing the code around a bit but most of the time it doesn’t work. And the only time that it did work, it loaded the data very slowly.

local DataStore2 = require(game.Workspace.MainModule) -- This is the Module we need I will post it in Description

local Vehicles = require(game.Workspace.ModuleScript2) -- You have to use a require(themodulescript/settingsucreated)

game.Players.PlayerAdded:Connect(function(plr) -- Plr added
	local testfolder ="Folder",plr)
	testfolder.Name = "VehicleData" -- sets the folder name

	for i,v in pairs(Vehicles) do
		local datastore = DataStore2(i,plr) --i = the datastorename , plr = the player
		local where = testfolder --Where the datastore gets saved at
		local val =
		val.Name = i -- // The name u did put on left side inside the Module
		val.Value = v.Value
		val.Parent = testfolder

			--// Loading
			if datastore:GetAsync() ~= nil then -- If datastore already exists
				val.Value = datastore:GetAsync() -- loads in plrs data

			val.Changed:connect(function() -- if Value changes 
				datastore:SetAsync(val.Value) -- Sets Datastore value to changed Value	

--It wont save since we are in studio but to make it save in studio we just create a boolvalue inside ServerStorage , make it true

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

is the Vehicles array defined in client & i think you have to initially set a datastore if a GetAsync attempt is nil (never makes a datastore to be able to get it)