I am trying to replace my old ‘mouse cursor over an object’ type of interface with proximity prompts.
So I am needing to know, is there any way to assign visibility to only certain groups, or any sort of black/white lists for prompts?
Just because an object has a prompt visible to one player does not mean it should be visible to all players.
I tried to solve this myself by disabling a prompt that was not visible to a certain player client side, but that got messy fast when trying to determine when to turn prompts ‘enabled’ back on if that player eventually met the requirement, because when disabled, there is no ‘PromptShown’ event fired, so for any Permission Changing Event, I would have to try and find all prompts in the game that related to that event and enable / disable as needed.
So I thought, perhaps I can just let all prompts stay enabled, but only draw ( I am using a custom ui for my prompts) the ones that my player has permissions to access.
This failed, due to the fact of having only one visible prompt per key code. If I had 2 prompts near me, both bound to the E key, and the closest one to me is the only one that would fire a PromptShown, but if I did not have permission to that prompt and did not draw it, I would never see the second prompt that I might have permission for.
I decided then to just let all the prompts roam free, and set them to allow multiples of the same key code to be shown, so I am getting PromptShown for ANY prompt in range, and am drawing only the ones that pertain to my player’s permissions. However… in doing this, I have to determine my own ‘closest’ prompt, as I only want to display the closest one, that I have permissions to per key code binding.
How should I determine ‘closest’? All my prompts are in Attachments, parented to a BasePart. So I can get the world position of the attachment by attachment:WorldCFrame.Position, but what do I compare it with? The camera? The HumanoidRootPart? The Head? What is the Proximity Prompt System that Roblox uses, comparing the distance of the prompts to?
Thank you for any help.