Shift 1
Shift 1
LocalPlayer
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local shiftPressed = false
local speed = 90 -- Adjust this value to change the speed of movement
local upwardSpeed = 74 -- Adjust this value to change the upward speed
local upwardThreshold = 1 -- Adjust this value to set the threshold for looking up
local cooldownTime = 0 -- Cooldown time in seconds
local onCooldown = false -- Tracks if the ability is on cooldown
-- Function to check if the player is looking up
local function isLookingUp()
local camera = workspace.CurrentCamera
local lookVector = camera.CFrame.LookVector
return lookVector.Y > upwardThreshold
end
-- Function to check if the player is looking down
local function isLookingDown()
local camera = workspace.CurrentCamera
local lookVector = camera.CFrame.LookVector
return lookVector.Y < -upwardThreshold
end
-- Function to move the player forward with upward velocity
local function moveForwardWithUpwardVelocity()
local forwardVector = player.Character.HumanoidRootPart.CFrame.LookVector
local upwardVelocity = Vector3.new(0, upwardSpeed, 0)
player.Character.HumanoidRootPart.Velocity = (forwardVector * speed) +
upwardVelocity
end
-- Function to handle cooldown
local function startCooldown()
onCooldown = true
wait(cooldownTime)
onCooldown = false
end
-- Check for keybind combination
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
shiftPressed = true
startCooldown()
end
end)
userInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
shiftPressed = false
end
end)
-- Continuous check for keybind combination and camera orientation
runService.RenderStepped:Connect(function()
if shiftPressed then
if isLookingUp() then
-- Move upward only if looking up
player.Character.HumanoidRootPart.Velocity = Vector3.new(0, speed, 0)
elseif not isLookingDown() then
-- Move forward with upward velocity if not looking down
moveForwardWithUpwardVelocity()
else
-- Move forward without upward velocity if looking down
local forwardVector =
player.Character.HumanoidRootPart.CFrame.LookVector
player.Character.HumanoidRootPart.Velocity = forwardVector * speed
end
end
end)