Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i get a text button working on phones and ipads?

Asked by 4 years ago

So I have these buttons in my Roblox game which are donations and they work perfectly fine on my laptop but when I play the game on my iPad and phone. They don’t work. How do I get the buttons to work on mobile devices ?. Do I need to add a script for touch screen??? I would really love the help. Basically the button does show up just doesnt do anything when i touch it on the screen yet when i click it when im on my laptop it does what its suppose to do. (let you by the pass.)

this is my script i have but for the button. is they anything i need to change about it ??

local plr = game.Players.LocalPlayer local button = script.Parent local MarketplaceService = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function() MarketplaceService:PromptGamePassPurchase(plr, 9963718) end)

0
Roblox does not require any additional code to make buttons work on touch screen devices, so the behavior of a button should be the same on a phone as it is on a computer. If the buttons aren't showing up at all when you're trying to play on smaller screen resolutions, check the properties of the button. Does its position property use Offset instead of Scale? If so, that may be the problem. vanilla_wizard 336 — 4y

1 answer

Log in to vote
-1
Answered by 4 years ago
Edited 4 years ago

"MouseButton1Click" is, as it says, firing when player uses a mouse to click on it. To fire a certain function when a mobile user presses a button, you need to use "TouchTap" event. It works in exactly the same way as "MouseButton1Click" but it's just for mobile users :)

local plr = game.Players.LocalPlayer 
local button = script.Parent
local MarketplaceService = game:GetService("MarketplaceService")

function onButtonClick()
    MarketplaceService:PromptGamePassPurchase(plr, 9963718) end)
end

script.Parent.MouseButton1Click:Connect(onButtonClick)
script.Parent.TouchTap:Connect(onButtonClick)
0
i used that and it didnt work.on ipad or my laptop. can you fix it please i really want this button to work on both devices Gleamingdrawsocute -35 — 4y
0
You do not need to use TouchTap to make a button work on touchscreen devices. vanilla_wizard 336 — 4y
0
Well, sorry, I've made a mistake :/ KrzysiekRoblox 50 — 4y
0
its fine if you have made a mistake just fix it and send it again :) if you can Gleamingdrawsocute -35 — 4y
Ad

Answer this question