Hello. I am trying to script a block system but I am having problem with one thing. I want the block to stop when player doesn’t hold F. Sometimes, when you just tap the button the block stays active since InputEnded does not fire. How can I fix that?
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
if stunned.Value then return end
if silenced.Value then return end
if health <= 0 then return end
if using.Value ~= "" then return end
if not equipped.Value then return end
if dashing.Value then return end
if db then return end
if UIS:IsKeyDown(Enum.KeyCode.Q) then return end
if input.KeyCode == Enum.KeyCode.F then
if blockDB then return end
if blockHealth.Value > 0 then
remote:FireServer("Block", tool, combatVariables, nil, "blockOn")
end
end
end)
UIS.InputEnded:Connect(function(input, gpe)
if gpe then return end
if stunned.Value then return end
if silenced.Value then return end
if health <= 0 then return end
if not equipped.Value then return end
if input.KeyCode == Enum.KeyCode.F then
if using.Value ~= "Blocking" then return end
if blockBrokenVar.Value then return end
if blockHealth.Value > 0 then
remote:FireServer("Block", tool, combatVariables, nil, "blockOff")
end
end
end)
As I said, when player taps the key the InputEnded doesn’t fire. I guess thats an engine limitation so I need alternative approaches.