I have a script below that checks if the player is holding the E key. Lets say if I press the R key while holding E it will stop the function because I guess the InputEnded event is firing. How do I make it so it will continue running if I am holding the E key while pressing other keys.
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local isHolding = false
local Power = 100
UIS.InputBegan:Connect(function(Key)
if UIS:IsKeyDown(Enum.KeyCode.E) then
if isHolding then return end
RunService:BindToRenderStep("Holding", Enum.RenderPriority.Input.Value, function()
Power = Power - 1
print("Power: "..Power)
end)
isHolding = true
end
end)
UIS.InputEnded:Connect(function()
isHolding = false
RunService:UnbindFromRenderStep("Holding")
end)