Hi! I am trying to make it so that the player can hold down a key for however long they want, and then when they release the key, the move will fire.
At the moment I have been trying to adapt a piece of code from a tutorial I found, as I am still learning scripting. The move, at the moment, will fire when the player simply taps the key. This is my code at the moment:
--
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.F and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "Fireball"
wait(0.1)
wait(0.15)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,30 do
wait()
hum.CameraOffset = Vector3.new(
math.random(-0,0),
math.random(-0,0),
math.random(-0,0)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
wait(0.15)
Tool.Active.Value = "None"
wait(2)
Debounce = true
end
end)
A good example of what I’m trying to create can be found in a game called King Legacy:
Here the player can charge up the move and then release by not holding down the key anymore.
I have tried looking all over the internet for this and I couldn’t really find anything. This is my first time posting on this website, so I’m very sorry if I get some things wrong. Thanks!