So I wanted to make a script where a certain player can be launched whenever they press a key. The problem is it won’t launch the player upwards whenever a certain key is pressed unless that key is being pressed with the spacebar key at the same time. So, I wanted only a certain key to make the player launch upwards while the player’s feet are touching the floor but I won’t work unless the player jumps and a certain key is pressed at the same time to launch the player even higher.
What can be a way to fix the problem?
Script:
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.T then
akeyPressed = true
while akeyPressed do
if cooldownValue == 5 then
PlayerAnim3:Play()
end
wait()
end
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.T then
akeyPressed = false
if cooldownValue == 5 then
print("run")
PlayerAnim3:Stop()
Player.Character.Torso.Velocity = Vector3.new(0,200,0)
cooldownValue = 0
for i = 0, 5, 1 do
cooldownValue = i
wait(1)
end
end
end
end)