So i was making gamepad controls for my Gun and it doesn't come up with red lines but it wont work when i play the game heres the script to show:

--------------------------------------------------------------------------------------
--------------------[ GAMEPAD CONTROLS ]------------------------------------------
--------------------------------------------------------------------------------------
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Gamepad1 then
        if input.KeyCode == Enum.KeyCode.ButtonX then
           if (not Reloading) and (not Running) then
			Reload()
        elseif input.KeyCode == Enum.KeyCode.ButtonB and S.CanKnife then
            if KnifeReady and (not Knifing) and (not ThrowingGrenade) then
			if Aimed then UnAimGun(true) end
			BreakReload = true
			Knifing = true
			KnifeReady = false
			KnifeAnim()
			BreakReload = false
			Knifing = false
			delay(S.KnifeCooldown, function()
				KnifeReady = true
			end)
        elseif input.KeyCode == Enum.KeyCode.ButtonL1 and S.Throwables then
            if (not Knifing) and (not Running) and (not Aimed) and (not Aiming) and (not ThrowingGrenade) then
			if TacticalGrenades.Value > 0 then
				TacticalGrenades.Value = TacticalGrenades.Value - 1
				ThrowingGrenade = true
				ThrowGrenade(2)
				ThrowingGrenade = false
        elseif input.KeyCode == Enum.KeyCode.ButtonY then
            				if (not AimingIn) and (not Aimed) then
					AimingIn = true
					AimGun()
					AimingIn = false
				end
			else
				if Aimed then
					UnAimGun()
							end
						end
					end
				end
        	end
    	end
	end
end)

4 comments

0

Is there any output? We can't know if there's an error unless you tell us your output

0

it doesnt show an output

0

Does using the gamepad actually work? Because it might be that your gamepad isn't connected to the computer properly.

0

it is connected