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

How do i get a button working on ipad and phones? [closed]

Asked by 3 years ago

This question already has an answer here:

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

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
You're asking the same question third time :/ KrzysiekRoblox 50 — 3y
0
because i havent got the answer yet Gleamingdrawsocute -35 — 3y

Marked as Duplicate by farrizbb, imKirda, User#29913, and killerbrenden

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

3 answers

Log in to vote
0
Answered by
Dec_ade 47
3 years ago
Edited 3 years ago
local plr = game.Players.LocalPlayer 
local button = script.Parent 
local MarketplaceService = game:GetService("MarketplaceService")

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

This makes it compatible for mobile devices etc.

You can also put this script in the same script as the pc version one.

Don't forget to accept answer if it worked!

Ad
Log in to vote
0
Answered by 3 years ago
local plr = game.Players.LocalPlayer 
local button = script.Parent 
local MarketplaceService = game:GetService("MarketplaceService")

button.MouseButton1Click:Connect(function()      
       MarketplaceService:PromptGamePassPurchase(plr, 9963718) 
end)
button.TouchTap:Connect(function()
       MarketplaceService:PromptGamePassPurchase(plr, 9963718)
end)
Log in to vote
0
Answered by 3 years ago

You can also use Activated for it to work with both:

https://developer.roblox.com/en-us/api-reference/event/GuiButton/Activated