How can I create a custom proximity prompt that mobile users can also interact with?

So, I’ve been using a script that changes proximity prompts to a custom ui

image

However, it has come to my attention (thank you Squid) that mobile users cannot interact with these prompts, how can I make this a possibility?

Here is the code for the localscript

local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptShown:Connect(function(promptInstance: ProximityPrompt)
	if promptInstance.Style == Enum.ProximityPromptStyle.Default then return end
	local CustomProximity = game.ReplicatedStorage:WaitForChild("CustomProximity"):Clone()
	CustomProximity.ObjectText.Text = promptInstance.ObjectText
	CustomProximity.ActionText.Text = "["..promptInstance.KeyboardKeyCode.Name.."] - " ..promptInstance.ActionText
	CustomProximity.Parent = promptInstance.Parent
	promptInstance.PromptHidden:Once(function()
		if CustomProximity then
			CustomProximity:Destroy()
		end
	end)
end)
1 Like

I actually ended up changing the ActionText textlabel to a TextButton instance

For anyone curious to know how I did it, here is my new script

local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptShown:Connect(function(promptInstance: ProximityPrompt)
	if promptInstance.Style == Enum.ProximityPromptStyle.Default then return end
	local CustomProximity = game.ReplicatedStorage:WaitForChild("CustomProximity"):Clone()
	CustomProximity.ObjectText.Text = promptInstance.ObjectText
	CustomProximity.ActionText.Text = "["..promptInstance.KeyboardKeyCode.Name.."] - " ..promptInstance.ActionText
	CustomProximity.Parent = game.Players.LocalPlayer.PlayerGui
	CustomProximity.Adornee = promptInstance.Parent
	local actionText = CustomProximity.ActionText
	actionText.MouseButton1Click:Connect(function(player)
		promptInstance:InputHoldBegin()
		promptInstance:InputHoldEnd()
	end)
	promptInstance.PromptHidden:Once(function()
		if CustomProximity then
			CustomProximity:Destroy()
		end
	end)
end)
2 Likes

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