I’m currently trying to make it so that a proximityprompt is shown as a GUI instead of being at the 3D object it’s bound to. So basically, whenever you’re within range of the proximityprompt, it would bring up the GUI.
I’m just not sure how to achieve this, and I’d love some help. Small detail but I’ve sort of come to a wall of errors when dealing with this.
You could use LocalPlayer:DistanceFromCharacter(position), then check if the returned value is less than 10 for example.
If the value is less than 10 you can set the ScreenGui property Enabled to true.
As @G_PL0X stated, you could run a loop constantly to check the distance of a player to the coordinate, if its less than 10, show the GUI.
But kinda inefficient due to the constant loop.
The proximity prompt in built feature to check when a player is near doesn’t require any loop, and it will fire an event when the player is close enough or far enough to show and hide.
Based on that event you can enable and disable a GUI you wanna show, and if you don’t want the real proximity prompt to show in game just set its Style to Custom
local YourGUI = script.Parent.YOUR_GUI -- change it to the GUI you want to show
-- Reference the ProximityPrompt in workspace
local ProxyPrompt = workspace:WaitForChild("ProxPart"):WaitForChild("ProximityPrompt")
-- Show
ProxyPrompt.PromptShown:Connect(function()
YourGUI.Enabled = true
end)
-- Hide
ProxyPrompt.PromptHidden:Connect(function()
YourGUI.Enabled = false
end)