Can't get custom prompts to work with duplicate names

  1. What do you want to achieve? Keep it simple and clear!
    I want to display the stats of the object the player is in range with.

  2. What is the issue? Include screenshots / videos if possible!
    image
    Whenever there’s 2 or more objects with the same name the stats of each object will display at the same time. I have honestly no clue how to solve this issue.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve done some digging on the devforum but there seems to be no solution for my problem on there. I have also been fooling around with the code for multiple hours, but I can’t wrap my finger around as to how I am supposed to achieve my goal.

Code that assigns a rarity to each object:

--// Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

--// Variables
local LocalPlayer = Players.LocalPlayer
local Signals = ReplicatedStorage:WaitForChild("Signals")
local Events = Signals:WaitForChild("Remotes"):WaitForChild("Events")
local Functions = Signals:WaitForChild("Remotes"):WaitForChild("Functions")
local Bindables = Signals:WaitForChild("Bindables")
local SpinAnimation

--// Modules
local Modules = ReplicatedStorage:WaitForChild("Modules")
local ObjectStats = require(Modules:WaitForChild("ObjectStats"))
local SoundManager = require(Modules:WaitForChild("SoundManager"))

--// GUI
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local FullCapacity = PlayerGui:WaitForChild("FullCapacity")

local highlightLookupDictionary = {}

function SetupBeam(object, interior)
	local Attachment = Instance.new("Attachment")
	Attachment.Parent = object.PrimaryPart
	
	local objectStat = ObjectStats[object.Name]
	if not objectStat then warn("Cannot find object stats for "..object.Name) return end

	local totalrarity = 0

	for i,v in pairs(objectStat.Rarity) do totalrarity += v end

	local function getRarity()
		local lootnum = math.random(totalrarity)
		local currentrarity = 0
		
		if interior.Name == "VipHouse" then
			for i, v in pairs(objectStat.Rarity) do
				v = 5
				return i
			end
		end

		for i,v in pairs(objectStat.Rarity) do
			currentrarity += v
			if lootnum <= currentrarity then return i end
		end
	end
	
	local Objects = {
		[object.Name] = {
			Rarity = getRarity(objectStat.Rarity),
		},
	}

	local function SetupPrompts()
		for index, object in pairs(interior:WaitForChild("HackableObjects"):GetChildren()) do
			
			if not object:FindFirstChild("ProximityPrompt") then else break end
			
			local objectPrompt = Instance.new("ProximityPrompt")
			objectPrompt.Parent = object
			objectPrompt.ObjectText = object.Name
			objectPrompt.ActionText = "Hack"
			objectPrompt.HoldDuration = 4
			objectPrompt.Style = "Custom"
		end
		
		if workspace.CurrentCamera:FindFirstChild("RandomizedObjects") then
			for index, object in pairs(workspace.CurrentCamera:WaitForChild("RandomizedObjects"):GetChildren()) do

				if not object:FindFirstChild("ProximityPrompt") then else break end

				local objectPrompt = Instance.new("ProximityPrompt")
				objectPrompt.Parent = object
				objectPrompt.ObjectText = object.Name
				objectPrompt.ActionText = "Hack"
				objectPrompt.HoldDuration = 4
				objectPrompt.Style = "Custom"
			end
		end
		
		if workspace.CurrentCamera:FindFirstChild("RandomizedObjects") then
			Bindables.GetCustomPrompt:Invoke(Objects, interior:WaitForChild("HackableObjects"), workspace.CurrentCamera:WaitForChild("RandomizedObjects"))
		else
			Bindables.GetCustomPrompt:Invoke(Objects, interior:WaitForChild("HackableObjects"))
		end
		
		local objectPrompt = object:FindFirstChild("ProximityPrompt")
		if not objectPrompt then warn("Cannot find a prompt for "..object.Name) return end
		
		objectPrompt.PromptShown:Connect(function()
			if not highlightLookupDictionary[object] then else return end
			
			local newHighlight = Instance.new("Highlight")
			newHighlight.FillColor = Color3.fromRGB(230, 230, 230)
			newHighlight.FillTransparency = 0.5
			newHighlight.DepthMode = Enum.HighlightDepthMode.Occluded
			newHighlight.Adornee = object
			newHighlight.Parent = PlayerGui
			
			highlightLookupDictionary[object] = newHighlight
		end)

		objectPrompt.PromptHidden:Connect(function()
			local proximityPromptHighlight = highlightLookupDictionary[object]
			if proximityPromptHighlight then else return end
			
			highlightLookupDictionary[object] = nil
			proximityPromptHighlight:Destroy()
		end)

		objectPrompt.PromptButtonHoldBegan:Connect(function()
			SoundManager:PlayAudio("Hacking")
			for i, Beam in ipairs(LocalPlayer.Character.Phone:GetChildren()) do
				if Beam:IsA("Beam") then
					Beam.Attachment0 = object.PrimaryPart.Attachment
					Beam.Attachment1 = LocalPlayer.Character.Phone.Handle.Attachment
				end
			end
			
			if object.Name == "Blender" then
				local Filling = object:FindFirstChild("Blender_Filling")
				if not Filling then wait("Cannot find filling for "..object.Name) return end
				
				local RNG = Random.new()
				local RandomNum = RNG:NextNumber(1, 10)
				local StartTime = os.clock()
				
				SpinAnimation = RunService.Heartbeat:Connect(function()
					local rotation = os.clock() - StartTime + RandomNum
					Filling.CFrame = Filling.CFrame * CFrame.Angles(0, (rotation * 0.5), 0)
				end)
			end
		end)

		objectPrompt.PromptButtonHoldEnded:Connect(function()
			SoundManager:DestroyAudio("Hacking")
			for i, Beam in ipairs(LocalPlayer.Character.Phone:GetChildren()) do
				if Beam:IsA("Beam") then
					Beam.Attachment1 = nil
				end
			end
			
			if object.Name == "Blender" then
				SpinAnimation:Disconnect()
			end
		end)

		objectPrompt.Triggered:Connect(function()
			local PlayerData = Functions.GetData:InvokeServer()
			
			local objectStat = ObjectStats[object.Name]
			if not objectStat then warn("Cannot find object stats for "..object.Name) return end
			
			if objectPrompt.HoldDuration == 0 and PlayerData.TempCapacity + PlayerData.Capacity > 0 then
				FullCapacity.Enabled = true
			else
				Events.TempCapacity:FireServer(objectStat.Capacity, object.Name, Objects)
			end
		end)
	end
	
	SetupPrompts()
end

function GetObjects(interior)
	local Objects = {}
	
	for index, objectModel in pairs(interior:WaitForChild("HackableObjects"):GetChildren()) do
		if index then else break end
		
		local objectStat = ObjectStats[objectModel.Name]
		if not objectStat then warn("Cannot find stats for "..objectModel.Name) continue end
		
		table.insert(Objects, objectModel)
	end
	
	if workspace.CurrentCamera:FindFirstChild("RandomizedObjects") then
		for index, objectModel in pairs(workspace.CurrentCamera:WaitForChild("RandomizedObjects"):GetChildren()) do
			if index then else break end

			local objectStat = ObjectStats[objectModel.Name]
			if not objectStat then warn("Cannot find stats for "..objectModel.Name) continue end

			table.insert(Objects, objectModel)
		end
	else
		return Objects
	end
	
	return Objects
end

function UpdateObjects(interior)
	local objectModels = GetObjects(interior)
	if not objectModels then return end
	
	for index, object in ipairs(objectModels) do
		if index then else break end
		
		task.spawn(function()
			SetupBeam(object, interior)
		end)
	end
end

Events.TempCapacity.OnClientEvent:Connect(function(hackedObject, Objects)
	if workspace.CurrentCamera:GetChildren()[1] then
		for index, object in pairs(workspace.CurrentCamera:GetDescendants()) do
			if object.Name == hackedObject then

				local objectPrompt = object:FindFirstChild("ProximityPrompt")			
				local objectStat = ObjectStats[object.Name]

				local proximityPromptHighlight = highlightLookupDictionary[object]
				for i, Beam in ipairs(LocalPlayer.Character.Phone:GetChildren()) do
					if Beam:IsA("Beam") then
						Beam.Attachment1 = nil
					end
				end
				objectPrompt:Destroy()
				highlightLookupDictionary[object] = nil
				if proximityPromptHighlight then
					proximityPromptHighlight:Destroy()
				end
				Bindables.PlayHackAnim:Invoke(object, Objects)
			end
		end
	else
		for index, object in pairs(workspace.SmallHouses.VipHouse:WaitForChild("HackableObjects"):GetChildren()) do
			if object.Name == hackedObject then
				local objectPrompt = object:FindFirstChild("ProximityPrompt")			
				local objectStat = ObjectStats[object.Name]

				local proximityPromptHighlight = highlightLookupDictionary[object]
				for i, Beam in ipairs(LocalPlayer.Character.Phone:GetChildren()) do
					if Beam:IsA("Beam") then
						Beam.Attachment1 = nil
					end
				end
				objectPrompt:Destroy()
				highlightLookupDictionary[object] = nil
				proximityPromptHighlight:Destroy()
				Bindables.PlayHackAnim:Invoke(object, Objects)
			end
		end
	end
end)

Bindables.StartHacking.OnInvoke = function(interior)
	UpdateObjects(interior)
end

Generating a custom prompt from the dev hub that I’ve tweaked

--// Services
local UserInputService = game:GetService("UserInputService")
local ProximityPromptService = game:GetService("ProximityPromptService")
local TweenService = game:GetService("TweenService")
local TextService = game:GetService("TextService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// Variables
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local Signals = ReplicatedStorage:WaitForChild("Signals")
local Bindables = Signals:WaitForChild("Bindables")
local Functions = Signals:WaitForChild("Remotes"):WaitForChild("Functions")
local Modules = ReplicatedStorage:WaitForChild("Modules")

--// Modules
local ObjectStats = require(Modules:WaitForChild("ObjectStats"))

local GamepadButtonImage = {
	[Enum.KeyCode.ButtonX] = "rbxasset://textures/ui/Controls/xboxX.png",
	[Enum.KeyCode.ButtonY] = "rbxasset://textures/ui/Controls/xboxY.png",
	[Enum.KeyCode.ButtonA] = "rbxasset://textures/ui/Controls/xboxA.png",
	[Enum.KeyCode.ButtonB] = "rbxasset://textures/ui/Controls/xboxB.png",
	[Enum.KeyCode.DPadLeft] = "rbxasset://textures/ui/Controls/dpadLeft.png",
	[Enum.KeyCode.DPadRight] = "rbxasset://textures/ui/Controls/dpadRight.png",
	[Enum.KeyCode.DPadUp] = "rbxasset://textures/ui/Controls/dpadUp.png",
	[Enum.KeyCode.DPadDown] = "rbxasset://textures/ui/Controls/dpadDown.png",
	[Enum.KeyCode.ButtonSelect] = "rbxasset://textures/ui/Controls/xboxView.png",
	[Enum.KeyCode.ButtonStart] = "rbxasset://textures/ui/Controls/xboxmenu.png",
	[Enum.KeyCode.ButtonL1] = "rbxasset://textures/ui/Controls/xboxLB.png",
	[Enum.KeyCode.ButtonR1] = "rbxasset://textures/ui/Controls/xboxRB.png",
	[Enum.KeyCode.ButtonL2] = "rbxasset://textures/ui/Controls/xboxLT.png",
	[Enum.KeyCode.ButtonR2] = "rbxasset://textures/ui/Controls/xboxRT.png",
	[Enum.KeyCode.ButtonL3] = "rbxasset://textures/ui/Controls/xboxLS.png",
	[Enum.KeyCode.ButtonR3] = "rbxasset://textures/ui/Controls/xboxRS.png",
	[Enum.KeyCode.Thumbstick1] = "rbxasset://textures/ui/Controls/xboxLSDirectional.png",
	[Enum.KeyCode.Thumbstick2] = "rbxasset://textures/ui/Controls/xboxRSDirectional.png",
}

local KeyboardButtonImage = {
	[Enum.KeyCode.Backspace] = "rbxasset://textures/ui/Controls/backspace.png",
	[Enum.KeyCode.Return] = "rbxasset://textures/ui/Controls/return.png",
	[Enum.KeyCode.LeftShift] = "rbxasset://textures/ui/Controls/shift.png",
	[Enum.KeyCode.RightShift] = "rbxasset://textures/ui/Controls/shift.png",
	[Enum.KeyCode.Tab] = "rbxasset://textures/ui/Controls/tab.png",
}

local KeyboardButtonIconMapping = {
	["'"] = "rbxasset://textures/ui/Controls/apostrophe.png",
	[","] = "rbxasset://textures/ui/Controls/comma.png",
	["`"] = "rbxasset://textures/ui/Controls/graveaccent.png",
	["."] = "rbxasset://textures/ui/Controls/period.png",
	[" "] = "rbxasset://textures/ui/Controls/spacebar.png",
}

local KeyCodeToTextMapping = {
	[Enum.KeyCode.LeftControl] = "Ctrl",
	[Enum.KeyCode.RightControl] = "Ctrl",
	[Enum.KeyCode.LeftAlt] = "Alt",
	[Enum.KeyCode.RightAlt] = "Alt",
	[Enum.KeyCode.F1] = "F1",
	[Enum.KeyCode.F2] = "F2",
	[Enum.KeyCode.F3] = "F3",
	[Enum.KeyCode.F4] = "F4",
	[Enum.KeyCode.F5] = "F5",
	[Enum.KeyCode.F6] = "F6",
	[Enum.KeyCode.F7] = "F7",
	[Enum.KeyCode.F8] = "F8",
	[Enum.KeyCode.F9] = "F9",
	[Enum.KeyCode.F10] = "F10",
	[Enum.KeyCode.F11] = "F11",
	[Enum.KeyCode.F12] = "F12",
}

local function getScreenGui()
	local screenGui = PlayerGui:FindFirstChild("ProximityPrompts")
	if screenGui == nil then
		screenGui = Instance.new("ScreenGui")
		screenGui.Name = "ProximityPrompts"
		screenGui.ResetOnSpawn = false
		screenGui.Parent = PlayerGui
	end
	return screenGui
end

local function createProgressBarGradient(parent, leftSide)
	local frame = Instance.new("Frame")
	frame.Size = UDim2.fromScale(0.5, 1)
	frame.Position = UDim2.fromScale(leftSide and 0 or 0.5, 0)
	frame.BackgroundTransparency = 1
	frame.ClipsDescendants = true
	frame.Parent = parent

	local image = Instance.new("ImageLabel")
	image.BackgroundTransparency = 1
	image.Size = UDim2.fromScale(2, 1)
	image.Position = UDim2.fromScale(leftSide and 0 or -1, 0)
	image.Image = "rbxasset://textures/ui/Controls/RadialFill.png"
	image.Parent = frame

	local gradient = Instance.new("UIGradient")
	gradient.Transparency = NumberSequence.new({
		NumberSequenceKeypoint.new(0, 0),
		NumberSequenceKeypoint.new(0.4999, 0),
		NumberSequenceKeypoint.new(0.5, 1),
		NumberSequenceKeypoint.new(1, 1),
	})
	gradient.Rotation = leftSide and 180 or 0
	gradient.Parent = image

	return gradient
end

local function createCircularProgressBar()
	local bar = Instance.new("Frame")
	bar.Name = "CircularProgressBar"
	bar.Size = UDim2.fromOffset(58, 58)
	bar.AnchorPoint = Vector2.new(0.5, 0.5)
	bar.Position = UDim2.fromScale(0.5, 0.5)
	bar.BackgroundTransparency = 1

	local gradient1 = createProgressBarGradient(bar, true)
	local gradient2 = createProgressBarGradient(bar, false)

	local progress = Instance.new("NumberValue")
	progress.Name = "Progress"
	progress.Parent = bar
	progress.Changed:Connect(function(value)
		local angle = math.clamp(value * 360, 0, 360)
		gradient1.Rotation = math.clamp(angle, 180, 360)
		gradient2.Rotation = math.clamp(angle, 0, 180)
	end)

	return bar
end

local function createPrompt(prompt, inputType, gui, CurrentStats, PlayerData, CurrentRarity)
	local tweensForButtonHoldBegin = {}
	local tweensForButtonHoldEnd = {}
	local tweensForFadeOut = {}
	local tweensForFadeIn = {}
	local tweenInfoInFullDuration = TweenInfo.new(
		prompt.HoldDuration,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out
	)
	local tweenInfoOutHalfSecond = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	local tweenInfoFast = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	local tweenInfoQuick = TweenInfo.new(0.06, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	
	local promptUI = Instance.new("BillboardGui")
	promptUI.Name = "Prompt"
	promptUI.AlwaysOnTop = true

	local frame = Instance.new("Frame")
	frame.Size = UDim2.fromScale(0.5, 1)
	frame.BackgroundTransparency = 1
	frame.BackgroundColor3 = Color3.new(0.07, 0.07, 0.07)
	frame.Parent = promptUI

	local roundedCorner = Instance.new("UICorner")
	roundedCorner.Parent = frame

	local inputFrame = Instance.new("Frame")
	inputFrame.Name = "InputFrame"
	inputFrame.Size = UDim2.fromScale(1, 1)
	inputFrame.BackgroundTransparency = 1
	inputFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY
	inputFrame.Parent = frame

	local resizeableInputFrame = Instance.new("Frame")
	resizeableInputFrame.Size = UDim2.fromScale(1, 1)
	resizeableInputFrame.Position = UDim2.fromScale(0.5, 0.5)
	resizeableInputFrame.AnchorPoint = Vector2.new(0.5, 0.5)
	resizeableInputFrame.BackgroundTransparency = 1
	resizeableInputFrame.Parent = inputFrame

	local inputFrameScaler = Instance.new("UIScale")
	inputFrameScaler.Parent = resizeableInputFrame

	local inputFrameScaleFactor = inputType == Enum.ProximityPromptInputType.Touch and 1.6 or 1.33
	table.insert(
		tweensForButtonHoldBegin,
		TweenService:Create(inputFrameScaler, tweenInfoFast, { Scale = inputFrameScaleFactor })
	)
	table.insert(tweensForButtonHoldEnd, TweenService:Create(inputFrameScaler, tweenInfoFast, { Scale = 1 }))

	local actionText = Instance.new("TextLabel")
	actionText.Name = "ActionText"
	actionText.Size = UDim2.fromScale(1, 1)
	actionText.Font = Enum.Font.GothamSemibold
	actionText.TextSize = 19
	actionText.BackgroundTransparency = 1
	actionText.TextTransparency = 1
	actionText.TextColor3 = Color3.new(1, 1, 1)
	actionText.TextXAlignment = Enum.TextXAlignment.Left
	actionText.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(actionText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(actionText, tweenInfoFast, { TextTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(actionText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(actionText, tweenInfoFast, { TextTransparency = 0 }))

	local objectText = Instance.new("TextLabel")
	objectText.Name = "ObjectText"
	objectText.Size = UDim2.fromScale(1, 1)
	objectText.Font = Enum.Font.GothamSemibold
	objectText.TextSize = 13
	objectText.BackgroundTransparency = 1
	objectText.TextTransparency = 1
	objectText.TextColor3 = Color3.new(0.7, 0.7, 0.7)
	objectText.TextXAlignment = Enum.TextXAlignment.Left
	objectText.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(objectText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(objectText, tweenInfoFast, { TextTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(objectText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(objectText, tweenInfoFast, { TextTransparency = 0 }))

	local rewardText = Instance.new("TextLabel")
	rewardText.Name = "RewardText"
	if CurrentRarity == nil then return end
	rewardText.Text = "$"..CurrentStats.Reward[CurrentRarity.Rarity]
	rewardText.Size = UDim2.fromScale(1, 1)
	rewardText.Font = Enum.Font.GothamSemibold
	rewardText.TextSize = 13
	rewardText.BackgroundTransparency = 1
	rewardText.TextTransparency = 1
	rewardText.TextColor3 = Color3.new(0.7, 0.7, 0.7)
	rewardText.TextXAlignment = Enum.TextXAlignment.Left
	rewardText.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(rewardText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(rewardText, tweenInfoFast, { TextTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(rewardText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(rewardText, tweenInfoFast, { TextTransparency = 0 }))

	local rarityText = Instance.new("TextLabel")
	rarityText.Name = "RarityText"
	rarityText.Text = CurrentRarity.Rarity
	rarityText.Size = UDim2.fromScale(1, 1)
	rarityText.Font = Enum.Font.GothamSemibold
	rarityText.TextSize = 13
	rarityText.BackgroundTransparency = 1
	rarityText.TextTransparency = 1
	rarityText.TextColor3 = CurrentStats.Color[CurrentRarity.Rarity]
	rarityText.TextXAlignment = Enum.TextXAlignment.Left
	rarityText.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(rarityText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(rarityText, tweenInfoFast, { TextTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(rarityText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(rarityText, tweenInfoFast, { TextTransparency = 0 }))

	local capacityImage = Instance.new("ImageLabel")
	capacityImage.Name = "CapacityImage"
	capacityImage.Image = "rbxassetid://11723087257"
	capacityImage.Size = UDim2.fromScale(0.15, 0.35)
	capacityImage.BackgroundTransparency = 1
	capacityImage.ImageTransparency = 1
	capacityImage.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(capacityImage, tweenInfoFast, { ImageTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(capacityImage, tweenInfoFast, { ImageTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(capacityImage, tweenInfoFast, { ImageTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(capacityImage, tweenInfoFast, { ImageTransparency = 0 }))

	local capacityText = Instance.new("TextLabel")
	capacityText.Name = "CapacityText"
	capacityText.Text = CurrentStats.Capacity
	capacityText.Size = UDim2.fromScale(1, 1)
	capacityText.Font = Enum.Font.GothamSemibold
	capacityText.TextSize = 19
	capacityText.BackgroundTransparency = 1
	capacityText.TextTransparency = 1
	capacityText.TextColor3 = Color3.new(0.7, 0.7, 0.7)

	if PlayerData.Capacity + PlayerData.TempCapacity + CurrentStats.Capacity > PlayerData.MaxCapacity then
		capacityText.TextColor3 = Color3.new(1, 0, 0)
		prompt.HoldDuration = 0
	end

	if PlayerData.Capacity + PlayerData.TempCapacity + CurrentStats.Capacity == PlayerData.MaxCapacity then
		capacityText.TextColor3 = Color3.new(1, 0.835294, 0)
	end

	if PlayerData.Capacity + PlayerData.TempCapacity + CurrentStats.Capacity < PlayerData.MaxCapacity then
		capacityText.TextColor3 = Color3.new(0.7, 0.7, 0.7)
	end

	capacityText.TextXAlignment = Enum.TextXAlignment.Left
	capacityText.Parent = frame
	table.insert(tweensForButtonHoldBegin, TweenService:Create(capacityText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForButtonHoldEnd, TweenService:Create(capacityText, tweenInfoFast, { TextTransparency = 0 }))
	table.insert(tweensForFadeOut, TweenService:Create(capacityText, tweenInfoFast, { TextTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(capacityText, tweenInfoFast, { TextTransparency = 0 }))


	table.insert(
		tweensForButtonHoldBegin,
		TweenService:Create(frame, tweenInfoFast, { Size = UDim2.fromScale(0.5, 1), BackgroundTransparency = 1 })
	)
	table.insert(
		tweensForButtonHoldEnd,
		TweenService:Create(frame, tweenInfoFast, { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 0.2 })
	)
	table.insert(
		tweensForFadeOut,
		TweenService:Create(frame, tweenInfoFast, { Size = UDim2.fromScale(0.5, 1), BackgroundTransparency = 1 })
	)
	table.insert(
		tweensForFadeIn,
		TweenService:Create(frame, tweenInfoFast, { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 0.2 })
	)

	local roundFrame = Instance.new("Frame")
	roundFrame.Name = "RoundFrame"
	roundFrame.Size = UDim2.fromOffset(48, 48)

	roundFrame.AnchorPoint = Vector2.new(0.5, 0.5)
	roundFrame.Position = UDim2.fromScale(0.5, 0.5)
	roundFrame.BackgroundTransparency = 1
	roundFrame.Parent = resizeableInputFrame

	local roundedFrameCorner = Instance.new("UICorner")
	roundedFrameCorner.CornerRadius = UDim.new(0.5, 0)
	roundedFrameCorner.Parent = roundFrame

	table.insert(tweensForFadeOut, TweenService:Create(roundFrame, tweenInfoQuick, { BackgroundTransparency = 1 }))
	table.insert(tweensForFadeIn, TweenService:Create(roundFrame, tweenInfoQuick, { BackgroundTransparency = 0.5 }))

	if inputType == Enum.ProximityPromptInputType.Gamepad then
		if GamepadButtonImage[prompt.GamepadKeyCode] then
			local icon = Instance.new("ImageLabel")
			icon.Name = "ButtonImage"
			icon.AnchorPoint = Vector2.new(0.5, 0.5)
			icon.Size = UDim2.fromOffset(24, 24)
			icon.Position = UDim2.fromScale(0.5, 0.5)
			icon.BackgroundTransparency = 1
			icon.ImageTransparency = 1
			icon.Image = GamepadButtonImage[prompt.GamepadKeyCode]
			icon.Parent = resizeableInputFrame
			table.insert(tweensForFadeOut, TweenService:Create(icon, tweenInfoQuick, { ImageTransparency = 1 }))
			table.insert(tweensForFadeIn, TweenService:Create(icon, tweenInfoQuick, { ImageTransparency = 0 }))
		end
	elseif inputType == Enum.ProximityPromptInputType.Touch then
		local buttonImage = Instance.new("ImageLabel")
		buttonImage.Name = "ButtonImage"
		buttonImage.BackgroundTransparency = 1
		buttonImage.ImageTransparency = 1
		buttonImage.Size = UDim2.fromOffset(25, 31)
		buttonImage.AnchorPoint = Vector2.new(0.5, 0.5)
		buttonImage.Position = UDim2.fromScale(0.5, 0.5)
		buttonImage.Image = "rbxasset://textures/ui/Controls/TouchTapIcon.png"
		buttonImage.Parent = resizeableInputFrame

		table.insert(tweensForFadeOut, TweenService:Create(buttonImage, tweenInfoQuick, { ImageTransparency = 1 }))
		table.insert(tweensForFadeIn, TweenService:Create(buttonImage, tweenInfoQuick, { ImageTransparency = 0 }))
	else
		local buttonImage = Instance.new("ImageLabel")
		buttonImage.Name = "ButtonImage"
		buttonImage.BackgroundTransparency = 1
		buttonImage.ImageTransparency = 1
		buttonImage.Size = UDim2.fromOffset(28, 30)
		buttonImage.AnchorPoint = Vector2.new(0.5, 0.5)
		buttonImage.Position = UDim2.fromScale(0.5, 0.5)
		buttonImage.Image = "rbxasset://textures/ui/Controls/key_single.png"
		buttonImage.Parent = resizeableInputFrame
		table.insert(tweensForFadeOut, TweenService:Create(buttonImage, tweenInfoQuick, { ImageTransparency = 1 }))
		table.insert(tweensForFadeIn, TweenService:Create(buttonImage, tweenInfoQuick, { ImageTransparency = 0 }))

		local buttonTextString = UserInputService:GetStringForKeyCode(prompt.KeyboardKeyCode)

		local buttonTextImage = KeyboardButtonImage[prompt.KeyboardKeyCode]
		if buttonTextImage == nil then
			buttonTextImage = KeyboardButtonIconMapping[buttonTextString]
		end

		if buttonTextImage == nil then
			local keyCodeMappedText = KeyCodeToTextMapping[prompt.KeyboardKeyCode]
			if keyCodeMappedText then
				buttonTextString = keyCodeMappedText
			end
		end

		if buttonTextImage then
			local icon = Instance.new("ImageLabel")
			icon.Name = "ButtonImage"
			icon.AnchorPoint = Vector2.new(0.5, 0.5)
			icon.Size = UDim2.fromOffset(36, 36)
			icon.Position = UDim2.fromScale(0.5, 0.5)
			icon.BackgroundTransparency = 1
			icon.ImageTransparency = 1
			icon.Image = buttonTextImage
			icon.Parent = resizeableInputFrame
			table.insert(tweensForFadeOut, TweenService:Create(icon, tweenInfoQuick, { ImageTransparency = 1 }))
			table.insert(tweensForFadeIn, TweenService:Create(icon, tweenInfoQuick, { ImageTransparency = 0 }))
		elseif buttonTextString ~= nil and buttonTextString ~= "" then
			local buttonText = Instance.new("TextLabel")
			buttonText.Name = "ButtonText"
			buttonText.Position = UDim2.fromOffset(0, -1)
			buttonText.Size = UDim2.fromScale(1, 1)
			buttonText.Font = Enum.Font.GothamSemibold
			buttonText.TextSize = 14
			if string.len(buttonTextString) > 2 then
				buttonText.TextSize = 12
			end
			buttonText.BackgroundTransparency = 1
			buttonText.TextTransparency = 1
			buttonText.TextColor3 = Color3.new(1, 1, 1)
			buttonText.TextXAlignment = Enum.TextXAlignment.Center
			buttonText.Text = buttonTextString
			buttonText.Parent = resizeableInputFrame
			table.insert(tweensForFadeOut, TweenService:Create(buttonText, tweenInfoQuick, { TextTransparency = 1 }))
			table.insert(tweensForFadeIn, TweenService:Create(buttonText, tweenInfoQuick, { TextTransparency = 0 }))
		else
			error(
				"ProximityPrompt '"
					.. prompt.Name
					.. "' has an unsupported keycode for rendering UI: "
					.. tostring(prompt.KeyboardKeyCode)
			)
		end
	end

	if inputType == Enum.ProximityPromptInputType.Touch or prompt.ClickablePrompt then
		local button = Instance.new("TextButton")
		button.BackgroundTransparency = 1
		button.TextTransparency = 1
		button.Size = UDim2.fromScale(1, 1)
		button.Parent = promptUI

		local buttonDown = false

		button.InputBegan:Connect(function(input)
			if
				(
					input.UserInputType == Enum.UserInputType.Touch
						or input.UserInputType == Enum.UserInputType.MouseButton1
				) and input.UserInputState ~= Enum.UserInputState.Change
			then
				prompt:InputHoldBegin()
				buttonDown = true
			end
		end)
		button.InputEnded:Connect(function(input)
			if
				input.UserInputType == Enum.UserInputType.Touch
				or input.UserInputType == Enum.UserInputType.MouseButton1
			then
				if buttonDown then
					buttonDown = false
					prompt:InputHoldEnd()
				end
			end
		end)

		promptUI.Active = true
	end

	if prompt.HoldDuration > 0 then
		local circleBar = createCircularProgressBar()
		circleBar.Parent = resizeableInputFrame
		table.insert(
			tweensForButtonHoldBegin,
			TweenService:Create(circleBar.Progress, tweenInfoInFullDuration, { Value = 1 })
		)
		table.insert(
			tweensForButtonHoldEnd,
			TweenService:Create(circleBar.Progress, tweenInfoOutHalfSecond, { Value = 0 })
		)
	end

	local holdBeganConnection
	local holdEndedConnection
	local triggeredConnection
	local triggerEndedConnection

	if prompt.HoldDuration > 0 then
		holdBeganConnection = prompt.PromptButtonHoldBegan:Connect(function()
			for _, tween in ipairs(tweensForButtonHoldBegin) do
				tween:Play()
			end
		end)

		holdEndedConnection = prompt.PromptButtonHoldEnded:Connect(function()
			for _, tween in ipairs(tweensForButtonHoldEnd) do
				tween:Play()
			end
		end)
	end

	triggeredConnection = prompt.Triggered:Connect(function()
		for _, tween in ipairs(tweensForFadeOut) do
			tween:Play()
		end
	end)

	triggerEndedConnection = prompt.TriggerEnded:Connect(function()
		for _, tween in ipairs(tweensForFadeIn) do
			tween:Play()
		end
	end)

	local function updateUIFromPrompt()
		-- todo: Use AutomaticSize instead of GetTextSize when that feature becomes available
		local actionTextSize = TextService:GetTextSize(
			prompt.ActionText,
			19,
			Enum.Font.GothamSemibold,
			Vector2.new(1000, 1000)
		)
		local objectTextSize = TextService:GetTextSize(
			prompt.ObjectText,
			14,
			Enum.Font.GothamSemibold,
			Vector2.new(1000, 1000)
		)
		local maxTextWidth = 100 -- Makes it so the prompt has a static width size instead of the size being dependent of the action/object text size (OLD VERSION) -> math.max(actionTextSize.X, objectTextSize.X)
		local promptHeight = 72
		local promptWidth = 72
		local textPaddingLeft = 72

		if
			(prompt.ActionText ~= nil and prompt.ActionText ~= "")
			or (prompt.ObjectText ~= nil and prompt.ObjectText ~= "")
		then
			promptWidth = maxTextWidth + textPaddingLeft + 24
		end

		local actionTextYOffset = 0
		if prompt.ObjectText ~= nil and prompt.ObjectText ~= "" then
			actionTextYOffset = -5
		end
		actionText.Position = UDim2.new(0.5, textPaddingLeft - promptWidth / 2, 0, actionTextYOffset)
		objectText.Position = UDim2.new(0.5, textPaddingLeft - promptWidth / 2, 0, -23)
		rewardText.Position = UDim2.new(0.5, textPaddingLeft - promptWidth / 2, 0, 10)
		rarityText.Position = UDim2.new(0.5, textPaddingLeft - promptWidth / 2, 0, 23)
		capacityText.Position = UDim2.new(0.9, textPaddingLeft - promptWidth / 2, 0, 23)
		capacityImage.Position = UDim2.new(0.96, textPaddingLeft - promptWidth / 2, 0, 45)

		actionText.Text = prompt.ActionText
		objectText.Text = prompt.ObjectText

		actionText.AutoLocalize = prompt.AutoLocalize
		actionText.RootLocalizationTable = prompt.RootLocalizationTable



		objectText.AutoLocalize = prompt.AutoLocalize
		objectText.RootLocalizationTable = prompt.RootLocalizationTable

		promptUI.Size = UDim2.fromOffset(promptWidth, promptHeight)
		promptUI.SizeOffset = Vector2.new(
			prompt.UIOffset.X / promptUI.Size.Width.Offset,
			prompt.UIOffset.Y / promptUI.Size.Height.Offset
		)
	end

	local changedConnection = prompt.Changed:Connect(updateUIFromPrompt)
	updateUIFromPrompt()

	promptUI.Adornee = prompt.Parent
	promptUI.Parent = gui

	for _, tween in ipairs(tweensForFadeIn) do
		tween:Play()
	end

	local function cleanup()
		if holdBeganConnection then
			holdBeganConnection:Disconnect()
		end

		if holdEndedConnection then
			holdEndedConnection:Disconnect()
		end

		triggeredConnection:Disconnect()
		triggerEndedConnection:Disconnect()
		changedConnection:Disconnect()

		for _, tween in ipairs(tweensForFadeOut) do
			tween:Play()
		end

		task.wait(0.2)

		promptUI:Destroy()
	end

	return cleanup
end

local function onLoad(Objects, HackableObjects, RandomizedObjects)
	ProximityPromptService.PromptShown:Connect(function(prompt, inputType)
		if prompt.Style == Enum.ProximityPromptStyle.Default then
			return
		end

		local CurrentStats = ObjectStats[prompt.ObjectText]
		
		local CurrentRarity = Objects[prompt.ObjectText]

		local PlayerData = Functions.GetData:InvokeServer()

		local gui = getScreenGui()

		local cleanupFunction = createPrompt(prompt, inputType, gui, CurrentStats, PlayerData, CurrentRarity)

		prompt.PromptHidden:Wait()

		if CurrentRarity ~= nil then
			cleanupFunction()
		end
	end)
end

Bindables.GetCustomPrompt.OnInvoke = function(Objects, HackableObjects, RandomizedObjects)
	onLoad(Objects, HackableObjects, RandomizedObjects)
end

Snippet of what the module script looks like:
image

If you have any clue as to how I could solve this problem it would be appreciated if you could provide any help! Also if there’s any bad practices in my code or things I can do better then feel free to let me know in the comments :slight_smile:

As for your other issue with multiple prompts showing at once, try messing with the properties of the actual ProximityPrompt instance. The property you’ll be looking for is Exclusivity. Mess around with that