How do I get a DataStore value and send it to the client?

So I’m trying to make a Shop UI that uses a currency called Protons. I have a script that controls DataStore values and is able to send them to the client when a RemoteEvent / RemoteFunction is called in ReplicatedStorage.

--[[Variables]]--
local DSS = game:GetService("DataStoreService")

local Remotes = {
	Function = game.ReplicatedStorage.Game.Events.Get_DSValue;
	Event = game.ReplicatedStorage.Game.Events.Set_DSValue;
	KEY = "";
}

--[[Main]]--

script.Parent.KEY:GetPropertyChangedSignal("Value"):Connect(function()
	Remotes.KEY = script.Parent.KEY.Value
end)

Remotes.Function.OnServerInvoke = function(Plr, Table)
	if not Table then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") return end
	if Table.Key ~= Remotes.KEY then Plr:Kick("\nRemotes Fired with invalid Table Key. \nDo not exploit.") return end
	if Table.Action == "GET_DSValue" then
		if not Table.Value then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") end
		if not Table.DSName then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") end
		local DS = DSS:GetDataStore(Table.DSName)
		local Value = Table.Value
		local Table = {Value = nil};
		
		local success, err = pcall(function()
			if DS:GetAsync(Value) then
				Table.Value = DS:GetAsync(Value)
			end
		end)
		
		if err then return "ERR" end
		return Table
	end
end

Remotes.Event.OnServerEvent:Connect(function(Plr, Table)
	print("Request Received")
	if not Table then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") return end
	if Table.Key ~= Remotes.KEY then Plr:Kick("\nRemotes Fired with invalid Table Key. \nDo not exploit.") return end
	if Table.Action == "POST_DSValue" then
		if not Table.ValueName then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") end
		if not Table.Value then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") end
		if not Table.DSName then Plr:Kick("\nRemotes Fired with invalid Table arguments. \nDo not exploit.") end
		local ValueName = Table.ValueName
		local DS = DSS:GetDataStore(Table.DSName)
		local Value = Table.Value
		local Table = {Value = 0};
		
		local success, err = pcall(function()
			DS:SetAsync(ValueName,Value)
		end)
		
		if err then return "ERR" end
		return Table
	end
end)

I have another script that controls client / server keys

local Rand = Functions.CreateKey(math.random(1,1000))
Remotes.KEY = Rand
script.Parent.KEY.Value = Rand

and on the client for the shop I have:

--[Variables]--
local Player = game.Players.LocalPlayer
local Teams = script.Parent
local DSName = "RPLINDEV_01"

print(DSName)

local Remotes = {
	Function = game.ReplicatedStorage.Game.Events.Get_DSValue;
	Event = game.ReplicatedStorage.Game.Events.Set_DSValue;
	KEY = ""
}

local Data = {
	Protons = 0;
}

local Functions = {
	Request = function(Table)
		return Remotes.Function:InvokeServer(Table)
	end;
	
	Send = function(Table)
		return Remotes.Event:FireServer(Table)
	end
}

--[Setup]--
game.ReplicatedStorage.Game.Events.SendKey.OnClientEvent:Connect(function(rkey)
	Remotes.KEY = rkey
end)

repeat wait() until Remotes.KEY ~= ""

local GetData = Functions.Request({Action = "GET_DSValue", Key = Remotes.KEY, DSName = DSName, Value = Player.UserId.."-protons"})

if GetData then
	if GetData.Value == nil then
		Functions.Send({Action = "POST_DSValue", ValueName = Player.UserId.."-protons", Value = 100, DSName = DSName})
		Data.Protons = 100
	else
		Data.Protons = GetData.Value
	end
end

script.Parent.Protons.Text = "Protons: "..tostring(Data.Protons)

I’ve tried printing the values, making sure things are being run from Client → Server and Server → Client but nothing seems to be working. Anyone know what I did wrong?

Depending on where your values are stored you can just read the values from the client and not modify them. I also dont recommend changing values from the client as exploiters could change anything of their own.