Trigger A Shown ProximityPrompt via GUI Button

Hello,

I’m currently making mobile support for my game, and I want to make it so when you press a GUI button, it will trigger a shown Proximity Prompt available in the Workspace. I don’t know how to do this though. I researched more about ProximityPrompts and ProximityPromptService, but that didn’t help me at all. Is there a way I can do to this sort of thing? Thanks!

1 Like

Are you trying to make it so the proximity prompt will be visible when you press a gui button or actually press the proximity prompt with the gui?

1 Like

Press the Proximity Prompt with the GUI.

Ill do some research and get back to you but you do know that mobile users can also interact with proximity prompts? so there isnt a need for a gui button to be used

1 Like

Yes, I do know that. But I want it to be via a GUI button because pressing it normally is not comfortable for mobile players, atleast not for the game I’m creating.

Im not sure if there is a way to do this. At this point i would just make a button apear whenever your near something that you want to have a function.

for example if your function has something to do with opening doors whenever your close to the door the gui will show up on the users screen and then if the player press the button the script will run and open the door.

this could be made with magnitude, remote events and more

sorry if this is misinformation ill let you know if im wrong but from i know so far about roblox studio i dont think there is a way to make button be responsible for proximity prompts

edit [ i would suggest watching videos about proximity prompt service a little more and proximity prompts in general, ill get back to you later ill look into this too. ]

1 Like

Alright, thank you for your help! I will look into it.

1 Like

After doing some more research, I got it working! Here was my solution:

local ProximityPromptService = game:GetService("ProximityPromptService")
local Button = script.Parent

ProximityPromptService.PromptShown:Connect(function(Prompt)
	Button.Activated:Connect(function()
	Prompt:InputHoldBegin()
	end)
end)

I had no idea :InputHoldBegin() was a thing, so I got stuck on this for hours even though there was a really simple solution, haha.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.