Would this work?

Hi,

So I a wondering if this would work for what I am trying to do.
So Basically, Its Supposed to a function that can be used for DataStore stuff like GetAsync, and SetAsync and all that but for one function.
However I’m not sure if this would work, or if some code is nessacary at all , This is the code:

-- List of Strings to Check to run 
local ReqData = {"GetAsync", "SetAsync", "UpdateAsync", "RemoveAsync", "IncrementAsync"}

function test(DataStore, ReqType, Key, Func)
    local found -- variable
    for i,v in ReqData do -- iterates through 'ReqData'
        if v ~= ReqType then -- skips if string does not match
            continue
        end
        found = v
    end
	if not found then -- if 'found' is nil
		return
	end
	
	local Success, Result -- two more variables
        
	-- Not sure if this if statement below is nessacary:
	if ReqType == "UpdateAsync" then -- if string is equal 
		Success, Result = pcall(DataStore[ReqType], DataStore, Key, Func) -- pcall
	else
		Success, Result = pcall(DataStore[ReqType], DataStore, Key) -- also pcall
	end
	
	return Success, Result -- returns Data
end

Sorry if this is vague.

No.
works fine without it.

You stated you aren’t sure and now stating that this works.

What are you trying to ask exactly ?

This is good. It looks good. Although can I ask what’s Func here ?