I want it to work differently on both mobile and PC but currently the mouse.Button1Down thing activates both, and it’s buggy on mobile because it includes dragging the stick or moving the camera. I am guessing it would use ContextActionService or something but how would I go about doing this?
You can use userinputservice to tell what device the player is on, and go from there.
local UserInputService = game:GetService("UserInputService")
if (UserInputService.KeyboardEnabled) then -- if they are on keyboard
print("The user's device has an available keyboard!")
button.MouseButton1Down:Connect(function()
end)
else
print("The user's device does not have an available keyboard!")
if UserInputService.TouchEnabled then --they are on phone
end
end
You can then tell when the phone user touches the phone by using the tactic in This Article.
2 Likes
count you use just Tool.Activated?
1 Like
That worked perfectly thank you!
1 Like
Yes but I am making something that requires Button1Down and Button1Up since it uses a charge up mechanic
oh, probably just use a gui for mobile users