ProxyPrompt not showing up in mobile device but show up in studio mobile device test?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    for the proxyprompt Style to be “Default” for mobile users

  2. What is the issue? Include screenshots / videos if possible!
    Proxyprompt shows up as default in studio when testing on mobile devices. But testing ingame on a mobile device it does not show up

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

First tried looking for a solution for custom proxy prompts with mobile but wasnt able to find something that works with the style i’ve created. I then moved onto what appeared to be working, having a separate script inside the proxy prompt that sets the style to default.

local UserInputService = game:GetService("UserInputService")

if UserInputService.TouchEnabled then
	script.Parent.Style = "Default" 
end

Im wondering why this works in studio with the “device test” set to a mobile phone but on a mobile device it does not work.

For anyone curious this is the local script that handles the custom proxyprompts, but this will not work on mobile cause theres no option to tap the proxyprompt

repeat wait() until game.Loaded
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
game:GetService("RunService").RenderStepped:Connect(function()


	if UserInputService.TouchEnabled then
		script.Enabled = false
	else
	
	
	if mouse.Target ~= nil then
		local pos = mouse.Target.Position
		local pos2 = player.Character.PrimaryPart.Position
		
		if mouse.Target.Name == "wallbuy" then
			if (pos - pos2).Magnitude <= 8 then
				if player.Character.WeaponHandler.Primary.value == mouse.Target.ProximityPrompt.Item.Value then
					
					player.PlayerGui.Prompts.BuyAmmo.Visible = true
					player.PlayerGui.Prompts.BuyAmmo.buy.Text = "Press [F] to buy Ammo"
					player.PlayerGui.Prompts.BuyAmmo.price.Text = mouse.Target.ProximityPrompt.AmmoPrice.Value
					
				else
				
				player.PlayerGui.Prompts.BuyGun.Visible = true
				player.PlayerGui.Prompts.BuyGun.buy.Text = "Press [F] to buy "..mouse.Target.ProximityPrompt.Item.Value
				player.PlayerGui.Prompts.BuyGun.price.Text = mouse.Target.ProximityPrompt.Price.Value
					
					end
			else
				player.PlayerGui.Prompts.BuyGun.Visible = false
				player.PlayerGui.Prompts.BuyAmmo.Visible = false
			end
		else
			player.PlayerGui.Prompts.BuyGun.Visible = false
			player.PlayerGui.Prompts.BuyAmmo.Visible = false
		end
		
		if mouse.Target.Name == "MeshPart" then
			if (pos - pos2).Magnitude <= 8 then
				if mouse.Target.Parent.Name == "pap" then

					player.PlayerGui.Prompts.Buyperk.Visible = true
					player.PlayerGui.Prompts.Buyperk.buy.Text = "Press [F] to Pack a Punch weapon"
					player.PlayerGui.Prompts.Buyperk.price.Text = mouse.Target.ProximityPrompt.Price.Value
					
				else
				
				
					player.PlayerGui.Prompts.Buyperk.Visible = true
					player.PlayerGui.Prompts.Buyperk.buy.Text = "Press [F] to buy "..mouse.Target.ProximityPrompt.Item.Value
					player.PlayerGui.Prompts.Buyperk.price.Text = mouse.Target.ProximityPrompt.Price.Value

				end
			else
				player.PlayerGui.Prompts.Buyperk.Visible = false

			end
		else
			player.PlayerGui.Prompts.Buyperk.Visible = false

		end
		
		if mouse.Target.Name == "MainTurret" then
			if (pos - pos2).Magnitude <= 8 then
			

					player.PlayerGui.Prompts.Buytrap.Visible = true
				player.PlayerGui.Prompts.Buytrap.buy.Text = "Press [F] to buy Trap"
				player.PlayerGui.Prompts.Buytrap.price.Text = mouse.Target.ProximityPrompt.Price.Value

				
			else
				player.PlayerGui.Prompts.Buytrap.Visible = false

			end
		else
			player.PlayerGui.Prompts.Buytrap.Visible = false

		end
		
		if mouse.Target.Name == "MainWunder" then
			if (pos - pos2).Magnitude <= 8 then


				player.PlayerGui.Prompts.BuyFizz.Visible = true
				player.PlayerGui.Prompts.BuyFizz.buy.Text = "Press [F] to buy WunderFizz"
				player.PlayerGui.Prompts.BuyFizz.price.Text = mouse.Target.ProximityPrompt.Price.Value
				player.PlayerGui.Prompts.BuyFizz.Take.Text = "Press [F] to take Perk"
			else
				player.PlayerGui.Prompts.BuyFizz.Visible = false

			end
		else
			player.PlayerGui.Prompts.BuyFizz.Visible = false

		end
		

		
		if mouse.Target.Name == "Barrier" then
			if (pos - pos2).Magnitude <= 8 then
				player.PlayerGui.Prompts.Repair.Visible = true
				
			else
				player.PlayerGui.Prompts.Repair.Visible = false
			end
		else
			player.PlayerGui.Prompts.Repair.Visible = false
		end
		
		if mouse.Target.Name == "Box" then
			if (pos - pos2).Magnitude <= 8 then
				player.PlayerGui.Prompts.BuyBox.Visible = true
				player.PlayerGui.Prompts.BuyBox.buy.Text = "Press [F] to buy Mysterybox"
				player.PlayerGui.Prompts.BuyBox.price.Text = "$950"
				
				player.PlayerGui.Prompts.BuyBox.Take.Text = game.Workspace.Map.Normal["Mystery Box"].GunGiven.Value
				
				
			else
				player.PlayerGui.Prompts.BuyBox.Visible = false
			end
		else
			player.PlayerGui.Prompts.BuyBox.Visible = false
		end
		
		if mouse.Target.Name == "DoorPart" then
			if (pos - pos2).Magnitude <= 8 then
				player.PlayerGui.Prompts.BuyDoor.Visible = true
				player.PlayerGui.Prompts.BuyDoor.buy.Text = "Press [F] to buy Door"
				player.PlayerGui.Prompts.BuyDoor.price.Text = mouse.Target.ProximityPrompt.Price.Value




			else
				player.PlayerGui.Prompts.BuyDoor.Visible = false
			end
		else
			player.PlayerGui.Prompts.BuyDoor.Visible = false
		end
		

	else
		player.PlayerGui.Prompts.BuyGun.Visible = false
		player.PlayerGui.Prompts.Repair.Visible = false
		end
		end
end)

Testing in studio


EDI:uploaded wrong video

Testing on my iPhone

You should have printed mouse.Target for mobile because mouse doesn’t work for mobile. You should use raycasts for all of it to begin with. I’m not sure why the ProximityPrompt style wouldn’t be working but just try this without setting the style to Default and remove the if UserInputService.TouchEnabled then script.Enabled = false end code.

Theoretically works but it’s 11:47pm and I haven’t tested it.

repeat task.wait(0.1) until game.Loaded

local player = game:GetService("Players").LocalPlayer
local character = player.Character
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

function runPrompt()
    local rayStart = character.PrimaryPart.CFrame
    local detectDistance = 8 -- Studs
    local ray = Ray.new(rayStart, rayStart.LookVector * detectDistance)
    local hitPart = workspace:FindPartOnRay(ray)
    if hitPart then
        -- Your Code Here
        -- Replace ANY "mouse.Target" with "hitPart"
    end
end
RunService.RenderStepped:Connect(runPrompt)

i actually may have found a solution, but i will try this as well. I basically added

if mouse.Target.Name == "wallbuy" then
			if (pos - pos2).Magnitude <= 8 then
				if UserInputService.TouchEnabled then --this

					mouse.Target.ProximityPrompt.Style = "Default" 
				end --end

to the code and its… kinda working. but i’ll try yours in a moment

Ya I’m not sure why the ProximityPrompt style being custom for mobile would be an issue, but I only ever use the default cause I’m lazy.

But raycasts are worth looking into because mouse shouldn’t be working for mobile at all. Mobile doesn’t have a mouse for you to detect. If you just raycast from the player’s PrimaryPart a certain distance away, it would work regardless of device type.

so i tried yours and im getting an error on line 11 “invalid argument #1 to ‘new’ (Vector3 expected, got CFrame)”

local ray = Ray.new(rayStart.p, rayStart.LookVector * detectDistance)

yessir that did the trick. mine was working as well with the added line but i like how yours is set it :slight_smile:

ahh dangit. i tested on my phone and no results :frowning:

funny thing, its doing the same thing as before. works in studio when device testing but on my iPhone no proxy prompt pops up

I’m not sure if you did or not, but you need to remove this. You’re turning the script off on mobile so not matter what it will not work. The reason this will work in studio regardless of this code, is studio doesn’t enable TouchEnabled for testing purposes if you use a new Device Type test, TouchEnabled will always return false meaning it “works” for mobile then actually doesn’t.

If you did remove that already then can you send your updated code so I can take a look.

It ended up working i think my phone was bugging out. I did notice this morning my studio updated so maybe that had something to do with it acting up.

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