I am making a bow which requires you to hold down your mouse button to charge up your shot, which gets fired upon release. How would I do something like this on mobile? It only works with an actual mouse at the moment
Edit: Just realised it does work with the original method I was using with mouse.Button1Down, except it still activates while moving the thumbstick or rotating the camera
To check if a player is on mobile you could use UserInputService.TouchEnabled, then you could either use UserInputService.TouchLongPress or UserInputService.TouchStarted and UserInputService.TouchEnded to detect when a player holds tap for a few seconds or to detect when a player starts tapping and ends the tap. I’m pretty sure with this it would work.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function()
print("Hey I am held down")
end)
Mouse.Button1Up:Connect(function()
print("Hey I am not held down anymore")
end)
Would this work if I made the GUI transparent and fit the entire screen? It still needs the mouse position to know where to shoot the arrow. I tried using UserInputService.TouchStarted but that enables it regardless of whether the user is also using the mobile interface GUI or rotating the screen
edit: nevermind it was using mouse.Button1Down when it was doing that
Huh, sorry about that. I could have sworn it didn’t work earlier. I just tried it again and it did work this time. Any idea how I would make it so touching the thumbstick or rotating the screen doesn’t activate it?