Global Chip-in system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a system where with the use of a datastore, players can chip in their credits to contribute to a Bar that shows how much players from around the world have contributed to this.

  2. What is the issue? Include screenshots / videos if possible!
    Tried to make an OrderedDataStore but the data would not save or load.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

local delVal = 5
local key = "GLOBAL_KEY_02"

local dataStoreService = game:GetService("DataStoreService")
local dataStore = dataStoreService:GetOrderedDataStore("GLOBAL_CHIPIN_002")

wait(5)

while true do
	if game.ReplicatedStorage.GlobalChipInValue then
		local ps = game.ReplicatedStorage.GlobalChipInValue
		local w = ps.Value
		if w then
			pcall(function()
				dataStore:UpdateAsync(key,function(oldVal)
					return tonumber(w)
				end)	
				print(w)
			end)
		end
	end
	wait(delVal)
end