One way to display the ProximityPrompt only when an item is being held is to use a script that checks if the player is holding the item and toggles the visibility of the ProximityPrompt accordingly.
First, create a ProximityPrompt and attach it to the item that you want to display it for. Set the PromptDistance property to the distance you want the prompt to appear and set the ActionText to the desired text.
Next, add a script to the item that will check if it is being held by the player. Inside the script, you can use the IsHeld property of the Tool object to determine if the item is being held by the player.
If the item is being held, set the ProximityPrompt Enabled property to true to display the prompt. Otherwise, set it to false to hide the prompt. Here's an example script:
local tool = script.Parent -- the item that the ProximityPrompt is attached to
local prompt = tool.ProximityPrompt -- the ProximityPrompt component
function onEquipped()
prompt.Enabled = true -- show prompt when item is equipped
end
function onUnequipped()
prompt.Enabled = false -- hide prompt when item is unequipped
end
tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)
In this script, the onEquipped and onUnequipped functions are connected to the Equipped and Unequipped events of the item, which are fired when the player equips or unequips the item. When the item is equipped, the ProximityPrompt is enabled to show the prompt. When it is unequipped, the ProximityPrompt is disabled to hide the prompt.
With this script, the ProximityPrompt will only be displayed when the item is being held by the player.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-28 12:28:29 +0000
Seen: 11 times
Last updated: Jun 28 '23
Despite setting `verbose` to `False`, why does Moviepy still display a progress bar?
How can I display a loading message in aggrid using react js?
How can Xcode 13.1 display the source code framework of an app?
How can I display the address field from the lead object in various sections?
Can AG-GRID display everything in a single column?
How can I modify Angular 8 to display a blank page without any error messages?
How can you display a Pandas Dataframe using a for loop?
How can the output of VBA be displayed in a cell within Excel?