Saving data in an object with cloud function not working

I’m trying to store a game score in the moralis server via cloud code, I’ve been able to get some data to pass and store but not the score not sure what Im doing wrong here is my javascript code:

setScore = async(points) => {
    currentSwanHolder = await Moralis.User.current();
    //let Points = parseInt(points);


   const params = {
       "player": currentSwanHolder.get('ethAddress'),
        "score" : points
    };

    const saveIt = await Moralis.Cloud.run('saveScore', params);

}

here is my cloud code

Moralis.Cloud.define("saveScore", async(res) =>{
    const Score = Moralis.Object.extend("swanHunters");
    const score = new Score();
  
    score.set("player", res.params.player);
    score.set("score", res.params.points);
  	
    score.save(null, { useMasterKey: true});
  
  return true
});

I can do this just fine if I don’t use a cloud function, updating storing user address and score but not as a cloud function only the user address is saved.

Did you try to log points data before running cloud function?

Yes and the data expected is returned the problem is with Moralis saving that data.

did you try to add some logging with logger.info ?

I can’t change the database when use cloud function too.
I get error “~.set is not a function”.

try logging the object data before using .set. You may get this error if the object you are trying to set is undefined or null.

Thank you!
It worked.