How can i make my custom Proximity Prompt clickable?

I am trying to make a custom proximity prompt, and all is going well EXCEPT the fact that it ISN’T clickable (Which is needed for mobile support).

image

This should definitely be possible, but I haven’t been able to find any other people who have had the same issue.

3 Likes

Where is the script that handles the pressing???

1 Like

It’s just a normal proximity prompt that has the style set to custom. I want it to work for all custom proximity prompts in the game, so the script that handles an individual prompt shouldn’t matter.

1 Like

This may help

The actual prompt, ui and stuff is done. It works normally - I just need help with making it clickable/touchable (for mobile users)

1 Like

Since there’s no MouseButton1Down and MouseButton1Up equivalents events for touch users, i suggest using InputBegan, InputChanged and InputEnded events to handle mobile user input.

1 Like

Hey there,

I think that ProximityPrompts are clickable for mobile users by default, it has an property called: ClickablePrompt, please make sure it is checked.

2 Likes

Thanks for the help but i’ve managed to find the answer:

All you have to do is make the prompt’s textbutton trigger InputHoldBegin() when the mouse is down and vice versa:

if inputtype == Enum.ProximityPromptInputType.Touch or prompt.ClickablePrompt then
			local button = gui.TextButton

			local buttonDown = false

			button.InputBegan:Connect(function(input)
				if (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1) and
					input.UserInputState ~= Enum.UserInputState.Change then
					prompt:InputHoldBegin()
					buttonDown = true
				end
			end)
			button.InputEnded:Connect(function(input)
				if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
					if buttonDown then
						buttonDown = false
						prompt:InputHoldEnd()
					end
				end
			end)

			gui.Active = true
		end
4 Likes

i did not understand im also having the same issue.