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

5 comments
Andddddddd whats your problem?
When the play holds the E button a part gets bigger and when released it stops
First of all, add a wait to "while keyHeld" Then just add into your while loop "yourpart.Size = yourpart.Size + Vector3.new(1,1,1)"
Still won't work, i updated the script with the current script right now
nvm i got it working, thanks