Recently I have been getting an error popping up that looks like this
InternalServerError
ReplicatedStorage.Modules.Library, line 150 - function getPlayerClickIncrement
ServerScriptService.Main Script, line 194
Server Version: 0.5.2
I went ahead and investigated as this was a new thing appearing and it seems to have something to do with :UserOwnsGamePassAsync
in the module script. Here is the function in the ModuleScript
function lib.getPlayerClickIncrement(currentPlayer, playersHammer, playerBonus)
local hammerTool = lib.getHammer(playersHammer)
local hammersClickIncValue = hammerTool:FindFirstChild("Value").Value
local currentClickIncrement = hammersClickIncValue
local playerCurrentRebirths = lib.getPlrStat(currentPlayer, "PlayerRebirth")
if playerCurrentRebirths.Value > 0 then --Get Rebirth Bonus
currentClickIncrement = currentClickIncrement + playerCurrentRebirths.Value
end
if playerBonus then --Get Player Buff Bonus
currentClickIncrement = currentClickIncrement * 2
end
local playerHasDoubleXpGamepass = MarketService:UserOwnsGamePassAsync(currentPlayer.UserId, 6838377) --Get Gamepass Bonus THIS IS LINE 150
if playerHasDoubleXpGamepass == true then
currentClickIncrement = currentClickIncrement * 2
end
return currentClickIncrement
end
This function is being called every time the Player clicks to get how many points that Player should receive when they click. My initial theory was I am asking if the Player owns the gamepass too much. So I was going to make a table of all the Player’s who own the gamepass and just check if the user who clicked Is in that table instead of constantly firing UserOwnsGamePassAsync
. But It states on the wiki page that
Results of this function are remembered so that repeated calls will return quicker. This function will always return true if the player owns the game pass upon first entering a server after having purchased the game pass.
So I don’t think calling it firing every time they click should be a problem. Is there anything else this could be? Could something else on the server be affecting this?