Did Roblox recently make player:GetRoleInGroup() cache on the server side? I noticed some weird behavior in my game and I suspect that’s the cause.
If that is the case, we need to have a way to get an uncached indication of a player’s rank and role in a group. I’ve already made some pretty hacky code to get around player:GetRankInGroup() being cached, I don’t want to have to pass instructions to a client and have to trust their response for rank verification.
As you can see, it means to store away for future use. For example, if I use player:GetRankInGroup(), the data that it returns will be saved internally. When I call this again even after the rank has changed in the group, it will still return the OLD value.
This is bad for many developers because some projects rely on up-to-date data to make a seamless experience while playing a game. For example, checking ownership of assets used to be a pain because all of the checking methods cached (PlayerHasAsset and the new gamepass checking methods don’t do this, which is good, but it used to be really annoying). Even after the user bought the asset, it would still say they didn’t own it if they were previously in that server at all.
To check if something caches, call it once, change the thing it should return (group rank, for example), and call it again. If it still has the same value as before, it caches. If it shows the correct value, it doesn’t.
“Async” in general programming refers to whether the function yields the thread it is called from. If I were to perform the equivalent of a dataStore save in JavaScript (as an example), the code after the dataStore save will run before the save is completed. I’m not entirely sure if Roblox is even using the term correctly, or just as a general indicator that the function can take a varying amount of time to complete.
I don’t see a logical correlation with Async functions and caching however.
I am curious as to whether or not the caching behaviour changed recently, I’ve had a few complaints from people within my group saying they their ranks were not updating immediately (it took several attempts of rejoining before it was updated), whereas before there were no issues.
Alright thanks, I’m pretty sure the behaviour has changed because it didn’t used to cache on the server as far as I could tell. I was able to update people’s ranks without them having to rejoin, at least there’s another solution.