Check If A Proximity Prompt Is Visible To The Player

You should move this outside of the PromptShown scope, because this causes your code to connect a new function to the PromptHidden event every single time a prompt is shown instead of once which could cause a memory leak

ProximityPromptService.PromptShown:Connect(function(ProximityPrompt)

	local Highlight = Instance.new("Highlight", ProximityPrompt.Parent); Highlight.FillColor = Color3.fromRGB(255, 255, 255); Highlight.FillTransparency = 1

end)

ProximityPromptService.PromptHidden:Connect(function(ProximityPrompt)
	local Highlight = ProximityPrompt:FindFirstChildOfClass("Highlight")
	Highlight:Destroy()
end)
2 Likes