You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m making a hold shift to run script and I want it to jump. -
What is the issue? Include screenshots / videos if possible!
I cant jump if I hold leftshift and W. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I found out that I can jump if I hold leftshift and D, S, or A.
Here is the code.
local PL = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local player = PL.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local cameraTweenInfo = TweenInfo.new(
0.75,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false,
0
)
local cameraOut = {
FieldOfView = 100
}
local cameraIn = {
FieldOfView = 70
}
local tweenCameraOut = TS:Create(camera, cameraTweenInfo, cameraOut)
local tweenCameraIn = TS:Create(camera, cameraTweenInfo, cameraIn)
UIS.InputBegan:Connect(function(input)
print("Input Began:", input.KeyCode)
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed += 8
tweenCameraIn:Pause()
tweenCameraOut:Play()
end
end)
UIS.InputEnded:Connect(function(input, gameProcessedEvent)
print("Input Ended:", input.KeyCode)
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed = 18
tweenCameraOut:Pause()
tweenCameraIn:Play()
end
end)