0% found this document useful (0 votes)
6 views2 pages

Shift 1

Uploaded by

tson28092008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Shift 1

Uploaded by

tson28092008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

local player = game.Players.

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)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy