ProximityPrompt with "RequiresLineOfSight" off reacts to camera rotation changes

  1. What do you want to achieve? I want to have my ProximityPrompt with LineOfSight off not be dependent on the camera, but on the character.

  2. What is the issue? Even with this value turned off, my frame still disappears when the camera moves away.

  3. What solutions have you tried so far? I’ve looked online, and found nothing. I’ve optimized my code to prevent opening and closing tweens from pausing the main execution thread.

LocalScript
--Services
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--Modules
local mainModule = require(ReplicatedStorage:WaitForChild("MainModule"))

--Make GUI appear when close
for _, gameTable in pairs(game.Workspace.Tables:GetChildren()) do
	if gameTable:IsA("Model") then
		local mainTablePart = gameTable:FindFirstChild("MainTable")
		local billboard = mainTablePart:FindFirstChild("BillboardGui")
		local prompt = mainTablePart.ProximityPrompt
		prompt.PromptShown:Connect(function()
			billboard.Size = UDim2.new(0,0,0,0)
			billboard.Enabled = true
			mainModule.tween(billboard,TweenInfo.new(.5,Enum.EasingStyle.Back),{Size=UDim2.new(10,0,7.5,0)})
		end)
		prompt.PromptHidden:Connect(function()
			local function tweenComplete()
				billboard.Enabled = false
			end
			mainModule.tween(billboard,TweenInfo.new(.5,Enum.EasingStyle.Back),{Size=UDim2.new(0,0,0,0)},tweenComplete)
		end)
	end
end
ModuleScript
--Services
local TweenService = game:GetService("TweenService")

local module = {}

module.tween = function(instance,tweenInfo,propertyTable,tweenCompleteFunction)
	local tweenTask = function()
		local tween = TweenService:Create(instance,tweenInfo,propertyTable)
		tween:Play()
		tween.Completed:Wait()
		if tweenCompleteFunction then
			tweenCompleteFunction()
		end
	end
	task.spawn(tweenTask)
end
return module

(There is no Server Script interacting with this ProximityPrompt in any way)
Space Game Pre-Release.rbxl (50.9 KB)

Also, sorry, I couldn’t really figure out where to put this. Both Scripting Support and Building Support sounded appropriate, but I feel this may be based on my code.

If there is no way to fix this, and I should just not use ProximityPrompts, please let me know :slight_smile:

Thanks, hope someone can help!

1 Like

bump so new people can see this, since nobody’s responded yet

My first thought is that you could implement a custom ProximityPrompt module that does what you describe (a BillboardGui that only pops up when you are a certain distance & your character is facing the target). I’m near certain that it would have worse performance than the existing ProximityPrompt module but if you need it for your game, then it might be worth the performance hit.