Custom Proximity Prompt For Mobile

well you already added some prints in your code. If the player click it, the prints should display on the output

Can you tell me why this isnt working?


local button = game.Workspace.Folder.ProxPart.BillboardGui.Frame.TextButton

local buttonDown = false

local input = game:GetService("UserInputService")

button.InputBegan:Connect(function(input)
	if (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1) and
		input.UserInputState ~= Enum.UserInputState.Change then
		print("trig")
		--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
			print("no trig")
			--buttonDown = false
		end
	end
end)

This is simple, in your case, you cannot do input.UserInputType:

local input = game:GetService("UserInputService")

button.InputBegan:Connect(function(input)
	if (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1) and
		input.UserInputState ~= Enum.UserInputState.Change then
		print("trig")
		--buttonDown = true
	end
end)

The UserInputType property can only be read inside a UserInputService connected event

Plus, a TextButton can only be triggered if you click it or tap it. Just use the following:

button.MouseButton1Click:Connect(function()
	print("Clicking or taping")
	
end)

After that, if you still want to make it working in your way, just turn TextButton into TextLabel or Frame and you can do the following:

local button = script.Parent
local Bool = false
local uis = game:GetService("UserInputService")

button.MouseEnter:Connect(function()
	Bool = true
	
end)

button.MouseLeave:Connect(function()
	Bool = false
	
end)

uis.InputBegan:Connect(function(input, gpe)
	if gpe or not Bool then return end
	input = input.UserInputType.Name
	
	if input == "Touch" or input == "MouseButton1" then
		print(input)
		
	end
	
end)

I do not understand. None of those methods worked on mobile or pc.

Is the property of your button enabled or active?

the button is both enabled and active