Custom ProximityPrompts do not disappear sometimes

so uh um i’ve got custom proximity prompts made, they are responsive and all of that (probably coded in the worst way imaginable but that’s okay!) but sometimes they just do not disappear

i’m not necessarily sure what the cause is since i have as much experience with proximity prompts as a child with rocket engineering (none)

local plr = game:GetService("Players").LocalPlayer
local plrGui = plr.PlayerGui.ProximityPrompts

-- // SERVICES
local RS = game:GetService("ReplicatedStorage")
local PPS = game:GetService("ProximityPromptService")
local TS = game:GetService("TweenService")

local Prompt = RS:WaitForChild("Prompt")

-- // TWEEN PARAMETERS
local info = TweenInfo.new(
	.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out
)

PPS.PromptShown:Connect(function(prompt, inputType)
	if prompt.Style == Enum.ProximityPromptStyle.Default then return end

	local newPrompt = Prompt:Clone()
	newPrompt.Parent = plrGui
	newPrompt.Adornee = prompt.Parent

	local Popup = newPrompt:FindFirstChild("Popup")
	Popup:Play()

	for _,v in newPrompt:GetDescendants() do
		if v.Name == "ObjectText" then
			v.Text = prompt.Parent.Parent.Parent.Name

		elseif v.Name == "ActionText" then
         -- // I am so sorry for this
			if prompt.Parent.Parent:IsA("Tool") then
				v.Text = "Take"
			elseif prompt.Parent.Parent:IsA("MeshPart") then
				v.Text = "Open"
			end
		end		
	end

	local OpenTween = TS:Create(newPrompt, info, {Size = UDim2.new(0, 200, 0, 100)})
	OpenTween:Play()

	OpenTween.Completed:Wait()
	OpenTween:Destroy()
end)

PPS.PromptHidden:Connect(function(prompt, inputType)
	local promptGui = plrGui:FindFirstChild("Prompt")

	if promptGui then
		local CloseTween = TS:Create(promptGui, info, {Size = UDim2.new(0,0,0,100)})
		local PopupClose = promptGui:FindFirstChild("PopupClose")
		PopupClose:Play()
		CloseTween:Play()

		CloseTween.Completed:Wait()
		CloseTween:Destroy()
		promptGui:Destroy()
	else
		return
	end
end)

the results are rather…

1 Like

So you’re wanting the proximity prompt that you use to open the locker to disappear when you open it? Or you’re wanting it to only really appear when you’re looking directly at it so it’s not overlapping?

3 Likes

nono

the proximity prompt of the locker disappears correctly upon interaction

it’s just that quickly triggering and looking away from the proximity prompt seems to keep it forever
that’s the problem!!

May I ask, does the script you posted completely control the proximity prompts? because this seems to be just the logic behind the custom prompt you made being added and destroyed, I have a suspicion it’s the tween not being completed before the code is trying to destroy it, causing it to error out and persist

it controls the prompts being shown and well, hidden

.PromptTriggered runs inside a seperate server script

i assume this is the answer you wanted

1 Like

I’m going to just say check if it’s the tween, I believe it’s just because the way you’re hiding it, instead of tweening try just enabling and disabling it, or spawning and destroying instead of tweening the size down

Once you know if it’s the tweens or not, let me know and I’ll look into the code a bit more and see if i can fix it for you, i just dont know where the problem is occuring because I’m not able to see your code base and the video you showed seems to only point at the tweening aspect of it causing errors despite not throwing them into the console

2 Likes

oh yeah it was the tweens
image

appreciate the help for such a small mistake

1 Like

all good, glad i was able to help!