From a quick look at your code, none of these variables are defined. You will need to assign the property from the entry to your $RoleDate, $Roleuser, $Roleid and $Roleip variables. Right now, if you have debugging on, you would likely get betting ‘undefined’ warnings. The code will continue, but it won’t do what you want it to.
I recommend adding your own custom logging statements to yourcode, so you can see where the code falls apart. You can find out how to enable logging here: https://docs.gravityforms.com/logging-and-debugging/#enabling-logging
Once you have enabled logging, it’s time to add your own logging statements to your own code, to see if your variables hold the values you expect them to, and your function calls are returning the correct values.
If you have any questions about setting up the custom logging, please let us know.