Jailbreak sprinting system?

How would I make a jailbreak type of sprinting system?

1 Like

I don’t play Jailbreak so hard to determine what you’re looking for specifically but I’d wager you don’t need too much involved as far as sprinting goes. Look into UserInputService (InputBegan and InputEnded specifically) and WalkSpeed.

2 Likes

This is so simple…
LocalScript in StarterPack

local humanoid = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
local uis = game:GetService("UserInputService")
local isInChat = false

uis.TextBoxFocused:Connect(function()
    isInChat = true
end)

uis.TextBoxFocusEnded:Connect(function()
    isInChat = false
end)

uis.InputBegan:Connect(function(inp)
    if inp.KeyCode == Enum.KeyCode.LShift or inp.KeyCode == Enum.KeyCode.RShift and isInChat == false then
        humanoid.WalkSpeed = 20
    end)
end)

uis.InputEnded:Connect(function(inp)
    if inp.KeyCode == Enum.KeyCode.LShift or inp.KeyCode == Enum.KeyCode.RShift and isInChat == false then
        humanoid.WalkSpeed = 16
    end)
end)
1 Like

I believe Jailbreak also has a FOV change when you begin running.

You should look into this using the script given by Ani
https://developer.roblox.com/en-us/api-reference/property/Camera/FieldOfView
Its optional if you want it, but adds a bit more than just changing walkspeed.

Additionally, you can lerp the FOV value.

function Lerp(a, b, t)
    return a + (b - a) * t
end
-- a = min number
-- b = max number
-- t = time
2 Likes

Can’t you use TweenService for it?

1 Like

I believe, however I do not know how TweenService works, so I just went with a simple lerp equation.

I’m still learning LUA, just here to help to the best that I can.

2 Likes

i forgot some roblox built in variable names so if you see something wrong pls let me know

-- services
local uis = game:GetService("UserInputService")
local players = game:GetService("Players")
-- instances
local char = players.LocalPlayer.Character;char = char or char.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
-- vars
local speed = 32
-- script
uis.InputBegan:Connect(function(key, isamogus)
  if (isamogus or (key.KeyCode ~= enum.KeyCode.E)) return
  humanoid.WalkSpeed = speed -- change it to what ever
end)
uis.InputEnded:Connect(function(key)
  if (key.KeyCode ~= enum.KeyCode.E) return
  humanoid.WalkSpeed = 16
end)
1 Like

As Colbert said, look into the basics of InputBegan and InputEnded. You would want to set the users walkspeed to something high while pressed, and back to the default when released. The default is 16, so I’d suggest going with anywhere between 20-25 for your sprint speed, but you should experiment with that.

Tweenservice version:

local camera = workspace.CurrentCamera
local tweenInfo = TweenInfo.new(1)
local targetFov = 80
local tween = game:GetService("TweenService"):Create(camera,tweenInfo,{FieldOfView = targetFov})
tween:Play()

I hope this helps you get an idea of how TweenService works, as it’s very useful.

I’d suggest you use something like

UIS.InputBegan:Connect(function(key, istyping)
     if istyping then return end
    -- code
end) 

to check if the player is typing or not.