in games like the strongest battlegrounds and hero battlegrounds, if you are holding mouse1, or square on a ps controller, or the mobile button, you keep punching until you let go. also, if you are holding F, you wil be blocking, but after getting stunned for example, if you are still holding F, you will block again automatically. how would i do this for my game? im currently trying to swap from UIS to CAS, so if you can, please tell me what i need to use to implement it preferably for CAS
You can make use of IsKeyDown.
Local UIS = game:GetService("UserInputService")
local keycode = Enum.KeyCode.Space
local keydown = UIS:IsKeyDown(keycode)
if keydown then
print("Player is pressing ".. tostring(keycode))
end
this works for pc and console, but is there any way to do this for mobile using context action service?
You want to check if the player is pressing a key on mobile, that is?
a button, maybe like an image button, i was wondering if i could use touchTap, or InputBegan
You can use MouseButton1Down, as it works for mobile
alright, thanks (cant mark both replies as solution)
1 Like
Good Luck with your game! Help needed, check DevForum and I’ll answer quickly.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.