Problem with Model Indexing

currently, i have a local script that is supposed to do the following:

  • if a proximity prompt exists within a model’s primary part, it compares the extracted number within the model’s name with the index of the current blocked user (which is in a table).
  • if they match, it changes the prompt text to “inspect model #index”.
  • if they don’t, it prints a message indicating how many users need to be blocked for this interaction to work properly.

this is the part that i’m having trouble with:

if blockedUserModel then
	local modelNumber  = tonumber(blockedUserModel.Name:match("#(%d+)"))

	print("Index: " .. index)
	print("modelNumber: " .. modelNumber)

	local proximityPrompt = blockedUserModel.PrimaryPart:FindFirstChild("ProximityPrompt")

	if proximityPrompt then
		if modelNumber then
			if modelNumber == index then
				proximityPrompt.ActionText = "inspect model#" .. index
			else
				proximityPrompt.ActionText = "you currently have less than " .. modelNumber .. " users blocked"
			end
		end
	else
		print("no proximity prompt found in model#" .. index)
	end
end

the portion that changes the action text to “you have less than x users blocked” simply does not function properly.