So I was just wondering if it was possible to activate a ProximityPrompt without somebody every interacting with it. For example I have a ServerScript and a ProximityPrompt. Now you can activate that ProximityPrompt but I can also activate it whenever they touch a part using a Script. Is this possible or do I have to use RemoteEvents, etc.
You can use ProximityPrompt:InputHoldBegin() and ProximityPrompt:InputHoldEnd(). Alternatively, you can just run the function connected to ProximityPrompt.Triggered when the player touches the part.
I just went on the roblox documentation to look this up. This is what I got: InputHoldBegin(): void
Fires a signal indicating that the user began pressing the prompt GUI button.
Wouldn’t this kind of be the same as doing .Triggered? Im sorry if im wrong since this is my first time seeing :InputHoldBegin() or if I did not explain it clearly so I will try to explain it again.
Instead of trying to activate code whenever someone uses the ProximityPrompt t I would like to activate the ProximityPrompt myself without anybody even being near it or pressing the key at all.
wait, so you just want to trigger an efffect that a proximity prompt would have if a player used it, without a player using it?
in that case, just save the function like this
function triggered()
--do something
end
proximityPrompt.Triggered:Connect(triggered)
--then you can also trigger the function without a player by just using "triggered()"
triggered()
Not really in the same script. But I just realized I could use a module script to achieve this effect right?
edit: I just realized that the function does do script.Parent so idk if module script will work.
Really this is what is going on. I have one script that sees if a proximityprompt is triggered and when it is a door opens. In another script im trying to make it so that all doors on the map open so im trying to trigger each of their proximityprompts. Sorry if this is inefficient.
just do a for loop through the door objects and run the opening function from module script on each one. have one parameter of the function be which door it is
or you might want to use collectionservice i dont know
Would it be more efficient to do what your saying or make a boolean value thats called IsOpen in each door object and just use a for loop to go through each one and set it to true. Then I will modify all my scripts to make it be closed or open based of that.
That method is somewhat less efficient, but you do gain the advantage of knowing when a specific door is opened or closed… Although you could employ alternative methods to determine that