When trying to do UserOwnsGamePassAsync() I get an error saying "InternalServerError"


local userInput = game:GetService("UserInputService")
local players = game:GetService("Players")
local MarketPlace = game:GetService("MarketplaceService")

local gamepassId = 137994956
local userInput = game:GetService("UserInputService")

local players = game:GetService("Players")


local sprintSpeed = 16 -- normal default walkspeed holding no buttons

local walkSpeed = 10  -- how fast you go holding shift

local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")



local function beginSprint(input, gameProcessed)

	if not gameProcessed then        
		if MarketPlace:UserOwnsGamePassAsync(player.UserId, 137994956) then
			if input.UserInputType == Enum.UserInputType.Keyboard then

				local keycode = input.KeyCode

				if keycode == Enum.KeyCode.LeftShift then 
					humanoid.WalkSpeed = sprintSpeed
				end
			end
		end
	end
end

--Player owns and not

local function endSprint(input, gameProcessed)
	if not gameProcessed then
		if MarketPlace:UserOwnsGamePassAsync(player.UserId, 137994956) then
			if input.UserInputType == Enum.UserInputType.Keyboard then

				local keycode = input.KeyCode

				if keycode == Enum.KeyCode.LeftShift then

					humanoid.WalkSpeed = walkSpeed

				end
			end
		end
	end
end


userInput.InputBegan:Connect(beginSprint)
userInput.InputEnded	:Connect(endSprint)

I put it into StarterCharacterScripts
Its a local script and this is what happens when you try use it:

Do I need to wrap this into a pcall? Or change it to a normal script?

I tried to change

MarketPlace:UserOwnsGamePassAsync(player.UserId, 137994956)

to

MarketPlace:PlayerOwnsAsset(player, 137994956)

but that didnt really help.

Tysm for any help

Yes, change it into a server script or connect a remote event to connect to the server. You should also definitely use pcalls to handle errors without your code completely stopping. If this issue persists, it’s probably that Roblox is down.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.