lZellkol
(Ebbie Luxury)
November 20, 2023, 11:28am
#1
I’m looking to check if someone is pressing ButtonB, then also check if they’re pressing ButtonX. ButtonB is an attack, and ButtonX is a dash.
If this is done correctly, It’ll return end when you press X during B.
You press B to do the attack. But I don’t want people to dash during the attack.
NoxhazeI
(Johnathan)
November 20, 2023, 11:30am
#2
I suppose what you can do is make a variable like:
local Bdown = false
Then make it true when B is down. Then while that is happening you can see if X gets pressed and do whatever you want.
1 Like
lZellkol
(Ebbie Luxury)
November 20, 2023, 11:31am
#3
The scripts are separate. So Bdown = false wouldn’t exactly work. This is why I was hoping I could register it based on inputs.
NoxhazeI
(Johnathan)
November 20, 2023, 11:32am
#4
Then you can use a bool value?
1 Like
lZellkol
(Ebbie Luxury)
November 20, 2023, 11:33am
#5
I tried that before and it didn’t work. I guess I’ll do it again. Thanks.
I think what you are looking for is this:
UserInputService:IsGamepadButtonDown
So in your dash script, check if ButtonB
is down before you allow them to dash. No need to set a variable for it.
1 Like
lZellkol
(Ebbie Luxury)
November 20, 2023, 12:17pm
#7
I was looking into that, but it confused me a bit. But I guess this IS the real answer.
The basic jist of the script is this…
local userInputService = game:GetService("UserInputService")
local function performDash()
if userInputService:IsGamepadButtonDown(Enum.UserInputType.Gamepad1,
Enum.KeyCode.ButtonB) == true then
return
end
-- Perform Humanoid Dash Ability
end
The only drawback is that you will have to figure out which gamepad is active.
1 Like
lZellkol
(Ebbie Luxury)
November 20, 2023, 12:48pm
#9
This is INSANELY helpful. Thank you so much! Does this check have to be a local function?
I always put local function
. You can use just function
if you want. Doesn’t really hurt anything that I’ve seen.
1 Like
lZellkol
(Ebbie Luxury)
November 20, 2023, 12:59pm
#11
Is there a list of all the Gamepads?
If you go through the list of methods that UserInputService
provides, there are a number of gamepad methods:
Are but a few.
system
(system)
Closed
December 4, 2023, 7:53pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.