Pressing T and Space bugs InputBegan

No matter what I do, when I hold the spacebar and “spam” press T at the same time, it will not register at all on ANY script with ANY code involving UserInputService. I have no idea why this is happening, but my only guess is that space + T is some kind of internal keybind that is used for something?

I have even noticed this on some popular games, It’s really annoying and nobody has said a single thing about this somehow

Just found out this may be linked to my keyboard somehow, I am not sure what it is though, is this a roblox setting or something?

I know it isn’t enjoyable, but it is essential to show code to get help from others.

1 Like
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local modules = ReplicatedStorage.Modules

local Keybinds = require(modules.Data.Keybinds)
local TweenWeld = require(modules.TweenWeld)
local ToolUtils = require(modules.ToolUtils)
local enumExists = require(modules.Util.enumExists)

local KICK_DURATION = 0.125
local KICK_COOLDOWN = 0.15

local DEFAULT_POWER = 18
local DEFAULT_ANGLE = 0.5

local FORCE_LIFETIME = 0.3

local ANIMATION_CFRAMES = {
	["Right Leg Start"] = CFrame.new(0.5, -2, 0),
	["Left Leg Start"] = CFrame.new(-0.5, -2, 0),
	["Right Leg End"] = CFrame.new(0.5, -1.7, -1.1) * CFrame.fromEulerAnglesXYZ(math.pi/4, -1, 0),
	["Left Leg End"] = CFrame.new(-0.5, -1.7, -1) * CFrame.fromEulerAnglesXYZ(0.78, -1, 0)
}
local TWEEN_INFO = TweenInfo.new(KICK_DURATION, Enum.EasingStyle.Back, Enum.EasingDirection.Out)

local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local rightLeg = character:WaitForChild("Right Leg")
local leftLeg = character:WaitForChild("Left Leg")

local tool = script.Parent

local isEquipped = false
local isKicking = false

local function onEquipped(mouse: Mouse)
	if isEquipped then
		return
	end
	isEquipped = true
end

local function onUnequipped()
	if not isEquipped then
		return
	end
	isEquipped = false
end

local function kick()
	if localPlayer:GetAttribute("Using") then
		local currentLeg = localPlayer:GetAttribute("CurrentLeg")
		
		isKicking = true
		
		if currentLeg == "Left Leg" then
			TweenWeld:tweenWeld(character, leftLeg, ANIMATION_CFRAMES["Left Leg Start"], ANIMATION_CFRAMES["Left Leg End"], TWEEN_INFO)
		else
			TweenWeld:tweenWeld(character, rightLeg, ANIMATION_CFRAMES["Right Leg Start"], ANIMATION_CFRAMES["Right Leg End"], TWEEN_INFO)
		end
		
		task.delay(KICK_DURATION, function()
			isKicking = false
			
			if currentLeg == "Left Leg" then
				TweenWeld:tweenWeld(character, leftLeg, ANIMATION_CFRAMES["Left Leg End"], ANIMATION_CFRAMES["Left Leg Start"], TWEEN_INFO)
			else
				TweenWeld:tweenWeld(character, rightLeg, ANIMATION_CFRAMES["Right Leg End"], ANIMATION_CFRAMES["Right Leg Start"], TWEEN_INFO)
			end
		end)
		task.delay(KICK_COOLDOWN, function()
			localPlayer:SetAttribute("Using", false)
			if not localPlayer:GetAttribute("Using") then
				TweenWeld:resetWelds(character)
			end
		end)
	end
end

local function onInputBegan(input: InputObject, gameProcessedEvent: boolean)
	if gameProcessedEvent then
		return
	end
	if not isEquipped then
		return
	end
	if localPlayer:GetAttribute("Using") then
		return
	end
	
	local enumItem = Keybinds.current[tool.Name][script.Name]
	local enum = enumExists("UserInputType", enumItem) and Enum.UserInputType[enumItem] or enumExists("KeyCode", enumItem) and Enum.KeyCode[enumItem]
	
	if input.UserInputType == enum or input.KeyCode == enum then
		localPlayer:SetAttribute("Using", true)
		kick()
	end
end

local function onTouched(otherPart: BasePart, limb: BasePart)
	if not isKicking then
		return
	end
	if character:GetAttribute("CurrentLeg") ~= limb.Name then
		return
	end
	if not otherPart:HasTag("Ball") then
		return
	end
	isKicking = false
	
	ToolUtils:requestNetworkOwnership(otherPart)
	
	otherPart.AssemblyLinearVelocity = Vector3.new()
	otherPart.AssemblyAngularVelocity /= 5
	
	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	bodyVelocity.Velocity = (humanoidRootPart.CFrame * CFrame.fromEulerAnglesXYZ(0, -1, 0)).LookVector * DEFAULT_POWER + (humanoidRootPart.CFrame.UpVector * DEFAULT_ANGLE)
	bodyVelocity.Parent = otherPart
	task.delay(FORCE_LIFETIME, function()
		bodyVelocity:Destroy()
	end)
end

tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)
UserInputService.InputBegan:Connect(onInputBegan)
rightLeg.Touched:Connect(function(otherPart: BasePart)
	onTouched(otherPart, rightLeg)
end)
leftLeg.Touched:Connect(function(otherPart: BasePart)
	onTouched(otherPart, leftLeg)
end)
local Keybinds = {
	current = {
		["Dribble"] = {
			["Dribble"] = "MouseButton1",
			["Right Dribble"] = "T", -- The bugged key
			["Left Dribble"] = "R",
			["Right Chop"] = "Z",
			["Left Chop"] = "X",
			["Precision Flick"] = "Q",
			["Stop"] = "F",
			["Flick Up"] = "Y",
			["Sombrero Flick"] = "G",
			["Rainbow Flick"] = "N",
		}
	}
}
1 Like

Do other key inputs work? If so then it may be because of your keyboard or some sort.

1 Like

Yes, all other inputs work while Im holding space, in fact, would you mind joining me and helping test? Maybe it is a keyboard issue

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.