How would i detect if a key is being help? For example : lets say you hold the E button to charge something to make it bigger and if you let go at any moment it fires at that moment. Like if you hold it for the max seconds you get a bigger ki blast, and if you don't you get different sized blast's depending on how long you held the E button.
I was thinking of doing this :
local UIS = game:GetService("UserInputService") keyHeld = game.workspace.Part.Size keyCharge = false UIS.InputBegan:Connect(function(Input) local KeyCode = Input.KeyCode if KeyCode == Enum.KeyCode.G and keyCharge == false then keyCharge = true print('started') end end) UIS.InputEnded:Connect(function(Input) local KeyCode = Input.KeyCode if KeyCode == Enum.KeyCode.G and keyCharge == true then keyCharge = false print('ended') end end) while keyCharge == true do wait(0.1) keyHeld.Size = keyHeld.Size +Vector3.new(1, 1, 1) --game.workspace.Part.Size = game. workspace.Part.Size +Vector3.new(1, 1, 1) end