If I hold spacebar for a while and keep pressing the key (in this case Enum.KeyCode.T) then nothing happens and the InputBegan just doesn’t work, tried printing all of the return statements, nothing came out. I can hold other keys at the same time and it would work, but when I hold space bar it doesn’t.
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