Proximity Prompt won't open ui anymore

Hello! So quick run down. my game is just an outfit catalog where people can find premade outfits and purchase them as they see fit. I got the UI from a popular youtube video I see most of these games follow. It was working just fine but I had a lot of lag in my game with all the outfits(over 350) loading in at the same time. on top of that some of my outfits would be missing accessories or hair and what not. I found a fix for that just recently and what that fix was, was putting all the outfit models into replicated storage and then putting a wait() on each row of outfits that loads in, and it works amazing, little to no lag, no missing accessories. but my proximity prompt won’t open the UI anymore. I’ve tried looking at my prompt script and then the other corresponding scripts that go with that UI. and I couldn’t find anything that I think would intervene with it. keep in mind I’m fairly new to scripting so please don’t use crazy scripting terms, THANK YOU!!

9 Likes

Did you rename or replace the proximityprompts?

2 Likes

(And by replace I mean change location/directory)

4 Likes

nope, I didn’t change any prompts or location or directory’s. My proximity prompt is located inside of a podium which just holds my character and then the prompt.

3 Likes

You need to use ;WaitForChild() method if you are loading stuff like this, or just add a task.wait() if your using an ipairs loop.

2 Likes

I use WaitForChild() for just about anything, unless it’s painfully obvious it’s unnecessary. this is what the inside of my prompt script looks like. i’m not sure if it’s something small or if it would be in the UI script itself.

2 Likes

Have you tried printing to see if the remote event fires to the client* ?

3 Likes

I just checked with the print. And it’s not printing/firing. why would that happen?

1 Like

Please send the code in your LocalScript, as well as that LocalScript’s location

1 Like

Yeah that would be pretty helpful

1 Like

here’s the location:
image_2025-01-10_173914386
here’s the local script:

local ShowUIEvent = game:GetService("ReplicatedStorage"):WaitForChild("HumanoidDescription")
local TryOutfitEvent = game:GetService("ReplicatedStorage"):WaitForChild("TryOutfit")
local Runs = game:GetService("RunService")
local CloseSound = script:WaitForChild("Close")
local WearSound = script:WaitForChild("Wear")
local WooshSound = script:WaitForChild("Woosh")
local viewportModelRotator = require(game.ReplicatedStorage.ViewportRotation)

local NPC = nil

----------------------------------[[ VIEWPORT PORTION ]]------------------------------

-- Settings
local OFFSET = CFrame.new(0,2.5,-7)

-- Services
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

-- Objects
local ViewPort = script.Parent.ImageLabel:WaitForChild("ViewportFrame")
local Camera = Instance.new("Camera")
ViewPort.CurrentCamera	= Camera

local ValidClasses = {
	["MeshPart"] = true; ["Part"] = true; ["Accoutrement"] = true;
	["Pants"] = true; ["Shirt"] = true;
	["Humanoid"] = true;
}

local RenderObjects = table.create(25)

local function RemoveObject(Object)
	local Clone = RenderObjects[Object]
	if not Clone then return nil end

	RenderObjects[Object] = nil
	if Clone.Parent:IsA("Accoutrement") then
		Clone.Parent:Destroy()
	else
		Clone:Destroy()
	end

	--print("Removed",Object)
end

local function AddObject(Object)
	if not ValidClasses[Object.ClassName] then
		return nil
	end

	-- Create clone, regardless of Archivable
	local a = Object.Archivable
	Object.Archivable = true
	local RenderClone = Object:Clone()
	Object.Archivable = a

	if Object.ClassName == "MeshPart" or Object.ClassName == "Part" then
		RenderObjects[Object] = RenderClone

	elseif Object:IsA("Accoutrement") then
		RenderObjects[Object.Handle] = RenderClone.Handle

	elseif Object.ClassName == "Humanoid" then
		--Disable all states. We only want it for clothing wrapping.
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.FallingDown,			false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Running,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics,	false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Climbing,			false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics,	false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.GettingUp,			false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Jumping,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Landed,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Flying,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Freefall,			false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Seated,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding,	false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Dead,				false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Swimming,			false)
		RenderClone:SetStateEnabled(Enum.HumanoidStateType.Physics,				false)
		RenderClone.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
	end

	--print("Added",Object)

	return RenderClone
end

----------------------------------[[ EVENT PORTION ]]------------------------------


ShowUIEvent.OnClientEvent:Connect(function(NPCEvent) 
	
	
	NPC = NPCEvent
	WooshSound:Play()
	script.Parent.Visible = true
	
	----------------------------------[[ VIEWPORT PORTION ]]------------------------------
	
	
	RunService.Heartbeat:Connect(function()
		if (not NPC:FindFirstChild("HumanoidRootPart")) or (not ViewPort.Visible) then
			return nil
		end

		-- Update camera
		Camera.CFrame = CFrame.new(NPC.HumanoidRootPart.CFrame:ToWorldSpace(OFFSET).Position, NPC.HumanoidRootPart.Position)

		-- Update objects
		for Original, Clone in pairs(RenderObjects) do
			if Original and Original.Parent then
				Clone.CFrame = Original.CFrame
			else
				RemoveObject(Original)
			end
		end
	end)

	local function HandleChar()
		--warn("Handle char")

		table.clear(RenderObjects)
		ViewPort:ClearAllChildren()

		local Viewmodel = Instance.new("Model")
		Viewmodel.Name = "PlayerViewmodel"
		Viewmodel.Parent = ViewPort

		local CharObjects = NPC:GetDescendants()
		for i, Object in pairs(CharObjects) do
			
			local RenderClone = AddObject(Object)
			if RenderClone then
				RenderClone.Parent = Viewmodel
			end
			
		end

		NPC.DescendantAdded:Connect(function(NewObject)
			local RenderClone = AddObject(NewObject)
			if RenderClone then
				RenderClone.Parent = Viewmodel
			end
		end)
		NPC.DescendantRemoving:Connect(function(OldObject)
			RemoveObject(OldObject)
		end)
		
		
	end
	
	HandleChar()
	
	----------------------------------[[ ACCESSORIES PORTION ]]------------------------------
	

	
	for _, Child in ipairs(script.Parent.ScrollingFrame:GetChildren()) do
		if Child:IsA("Frame") then
			Child:Destroy()
		end
	end

	local Accessories = {}
	local Accessories2 = {}

	local Backs = NPC.Humanoid:WaitForChild("HumanoidDescription").BackAccessory
	local BacksTable = Backs:split(",")
	for _, Back in ipairs(BacksTable) do
		if Back ~= 0 then
			if tonumber(Back) then
				table.insert(Accessories, Back)
			end
		end
	end	

	local Face = NPC.Humanoid:WaitForChild("HumanoidDescription").FaceAccessory
	local FaceTable = Face:split(",")
	for _, FaceAC in ipairs(FaceTable) do
		if FaceAC ~= 0 then
			if tonumber(FaceAC) then
				table.insert(Accessories, FaceAC)
			end
		end
	end	

	local Fronts = NPC.Humanoid:WaitForChild("HumanoidDescription").FrontAccessory
	local FrontsTable = Fronts:split(",")
	for _, Front in ipairs(FrontsTable) do
		if Front ~= 0 then
			if tonumber(Front) then
				table.insert(Accessories, Front)
			end
		end	
	end

	local Hairs = NPC.Humanoid:WaitForChild("HumanoidDescription").HairAccessory
	local HairsTable = Hairs:split(",")
	for _, Hair in ipairs(HairsTable) do
		if Hair ~= 0 then
			if tonumber(Hair) then
				table.insert(Accessories, Hair)
			end
		end
	end

	local Hats = NPC.Humanoid:WaitForChild("HumanoidDescription").HatAccessory
	local HatsTable = Hats:split(",")
	for _, Hat in ipairs(HatsTable) do
		if Hat ~= 0 then
			if tonumber(Hat) then
				table.insert(Accessories, Hat)
			end
		end
	end

	local Necks = NPC.Humanoid:WaitForChild("HumanoidDescription").NeckAccessory
	local NecksTable = Necks:split(",")
	for _, Neck in ipairs(NecksTable) do
		if Neck ~= 0 then
			if tonumber(Neck) then
				table.insert(Accessories, Neck)
			end
		end
	end

	local Shoulders = NPC.Humanoid:WaitForChild("HumanoidDescription").ShouldersAccessory
	local ShouldersTable = Shoulders:split(",")
	for _, Shoulder in ipairs(ShouldersTable) do
		if Shoulder ~= 0 then
			if tonumber(Shoulder) then
				table.insert(Accessories, Shoulder)
			end
		end
	end

	local Waists = NPC.Humanoid:WaitForChild("HumanoidDescription").WaistAccessory
	local WaistsTable = Waists:split(",")
	for _, Waist in ipairs(WaistsTable) do
		if Waist ~=  0 then
			if tonumber(Waist) then
				table.insert(Accessories, Waist)
			end
		end
	end

	local Face = NPC.Humanoid:WaitForChild("HumanoidDescription").Face
	if tonumber(Face) then
		table.insert(Accessories, Face)
	end	

	local Shirt = NPC.Humanoid:WaitForChild("HumanoidDescription").Shirt
	if tonumber(Shirt) then
		table.insert(Accessories, Shirt)
	end	

	local Pants = NPC.Humanoid:WaitForChild("HumanoidDescription").Pants
	if tonumber(Pants) then
		table.insert(Accessories, Pants)
	end	

	local GraphicTShirt = NPC.Humanoid:WaitForChild("HumanoidDescription").GraphicTShirt
	if tonumber(GraphicTShirt) then
		table.insert(Accessories, GraphicTShirt)
	end	
	
	local AdditionalAccessories = NPC.Humanoid:WaitForChild("HumanoidDescription"):GetAttribute("ExtraAccessories")
	if AdditionalAccessories then
		local ExtraTable = AdditionalAccessories:split(",")
		for _, Extra in ipairs(ExtraTable) do
			if Extra ~=  0 then
				if tonumber(Extra) then
					table.insert(Accessories, Extra)
				end
			end
		end
	end
	
	local BuggedAccessories = NPC.Humanoid:WaitForChild("HumanoidDescription"):GetAttribute("Priceless")
	if BuggedAccessories then
		local BuggedTable = BuggedAccessories:split(",")
		for _, Bugged in ipairs(BuggedTable) do
			if Bugged ~=  0 then
				if tonumber(Bugged) then
					table.insert(Accessories2, Bugged)
				end
			end
		end
	end

	local AddedTable = {}

	for _, ID in ipairs(Accessories) do
		if ID ~= 0 then
			if tonumber(ID) then
				if not table.find(AddedTable, ID) then
					table.insert(AddedTable, ID)
					local Template = script.Template

					local NewTemplate = Template:Clone()
					NewTemplate.ProductIDVal.Value = ID
					NewTemplate.AssetIcon.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=" .. ID .. "&width=420&height=420&format=png"

					NewTemplate.Parent = script.Parent.ScrollingFrame
				end
			end
		end
	end
	
	print("Finished first table")
	
	for _, ID in ipairs(Accessories2) do
		print("Going through accessories2")
		if ID ~= 0 then
			print("ID ~= 0")
			if tonumber(ID) then
				print("Got ID")
				if not table.find(AddedTable, ID) then
					print("Creating button")
					table.insert(AddedTable, ID)
					local Template = script.Template

					local NewTemplate = Template:Clone()
					NewTemplate.ProductIDVal.Value = ID
					NewTemplate.AssetIcon.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=" .. ID .. "&width=420&height=420&format=png"
					NewTemplate.Cost.Text = "Offsale"

					NewTemplate.Parent = script.Parent.ScrollingFrame
				end
			end
		end
	end
	
end)

sorry it’s long I just genuinely didn’t know which portion was the most important to take.

1 Like

I’ve had issues in the past with the triggered event for proximityprompts, let me research possible causes

1 Like

And you said your verified that your ShowUIEvent.OnClientEvent event listener is not running? How about the rest of your script? How about the server-sided script?

1 Like

Maybe its something with the proximityprompt, try setting it’s holdduration to 0

1 Like

You could also use Instance.new() to make a new proximityprompt via script, or just delete one and add another to see if that works

2 Likes

I’ll try that soon my gf is on my computer. but that seems very promising. I’ll lyk in a few hours. Thank you!

1 Like

Yes I checked inside my prompt script and it doesn’t print once the event is supposedly fired. I put my print directly 1 line below it firing the event. and nothing printed. and everything is done locally. the only server sided script I have is the one inside the proximity prompt. the game is very local sided.

1 Like

Proximityprompts don’t run locally

1 Like

ProximityPrompts begin with the client; their events and the like can be involved with a LocalScript

1 Like

Weird, whenever I try to run proximityprompts on the clientside it never works (atleast for me)

1 Like