3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried making a state-based system that did not work.
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = game.Workspace.Camera
local tweenService = game:GetService("TweenService")
local ShiftOn = {}
ShiftOn.FieldOfView = 110
local shiftOff = {}
shiftOff.FieldOfView = 90
local tweenInfo = TweenInfo.new(1)
local tweenOn = tweenService:Create(camera, tweenInfo, ShiftOn)
local tweenOff = tweenService:Create(camera, tweenInfo, shiftOff)
local BoostSpeed = 28
local NormalSpeed = 16
UIS.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed = BoostSpeed
tweenOn:Play()
end
end
end)
UIS.InputEnded:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed = NormalSpeed
tweenOff:Play()
end
end
end)
Sorry if i made any mistakes, it’s my first post here.
I tried your code in studio and it works perfectly fine, I can run and jump at the same time. Are you sure you dont have any other conflicting scripts that may be stopping you? Otherwise I believe it may be your keyboard not allowing you to press shift and space at the same time.
In your script, except that you are tempting with humanoid jump power or jump height, jumping should not be affected. Therefore, jumping should not be unavailable with this script.
What I advise is check other scripts that could potentially be tempting with jumppower, but I am sure that it won’t be affected in this particular script!
These are the other scripts that modify the player’s camera/movement
Double Jump script
--[[
Based off @viperology11's script
]]
local jumpMulti = 2
local maxExtraJumps = 1
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
if Character == nil then Player.CharacterAdded:Wait() end
local Humanoid = Character:WaitForChild("Humanoid")
local Material = Enum.Material
local StateType = Enum.HumanoidStateType
local boostCount = 0
local lastJump = false
RunService.RenderStepped:Connect(function()
if Humanoid.FloorMaterial == Material.Air or boostCount == 0 then return end
boostCount = 0
Humanoid.JumpHeight /= jumpMulti
end)
local function Boost()
if boostCount >= maxExtraJumps then return end
if boostCount == 0 then Humanoid.JumpHeight *= jumpMulti end
boostCount += 1
Humanoid:ChangeState(StateType.Jumping)
game.ReplicatedStorage.Audio.DoubleJump:Play()
end
RunService.RenderStepped:Connect(function()
if Humanoid.Jump == true and Humanoid.FloorMaterial == Material.Air and lastJump == false then Boost() end
lastJump = Humanoid.Jump
end)
Shift Lock Script
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local plr = game:GetService("Players").LocalPlayer
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart
local value = game.ReplicatedStorage.Values.ShiftLockOn
function shiftLock(active)
if active then
hum.AutoRotate = false
hum.CameraOffset = Vector3.new(1.75,0,0)
game:GetService("RunService"):BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
end)
else
hum.CameraOffset = Vector3.new(0,0,0)
game:GetService("RunService"):UnbindFromRenderStep("ShiftLock")
hum.AutoRotate = true
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default
end
end
shiftLock(true)
value.Changed:Connect(function()
shiftLock(value.Value)
end)
I don’t see anything that might’ve blocked the player from jumping so i decided to post the scripts here