Transition running

! If you don’t know what this is, it’s a moving transition where when you begin walking you transition to running after a short period of time.

Introduction

Uh- Hi, I’m back with a tutorial this time. I’m not the best with explaining but I will most certainly try my best for you!

So this will be client sided, although I am still learning server sided it’s not really my style at the moment, but there will be a server sided one if requested!

Movement transition

We firstly want to check when we actually move into a transition before anything else.

--: RunningTransitionHandler

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid : Humanoid = Character:WaitForChild("Humanoid") --: To make IntelliSense actually work, we use the Humanoid : Humanoid figure, when we list a variable, you can use the ':' to show what class it is (e.g: "local variable : bool = true")

Humanoid.Running:Connect(function(Speed)
	if Speed > 0 then
		--: We have began to walk
		print("Transition begin")
	else
		--: We have stopped walking
		print("Transition end")
	end
end)

If we run it, you may see that when we walk it will print “Transition begin” twice, this is fine, but when we jump we want to change it, so we’re going to add these lines of code to it instead!

--: RunningTransitionHandler

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid : Humanoid = Character:WaitForChild("Humanoid") --: To make IntelliSense actually work, we use the Humanoid : Humanoid figure, when we list a variable, you can use the ':' to show what class it is (e.g: "local variable : bool = true")

Humanoid.Running:Connect(function(Speed)
	if Speed > 0 and Humanoid.FloorMaterial or Speed > 0 and Humanoid.FloorMaterial ~= Enum.Material.Air then
		--: We have began to walk
		print("Transition begin")
	else
		--: We have stopped walking
		print("Transition end")
	end
end)

When we run this, we should not affect our transition checker when jumping atleast more than once! Now this should not burn out our code with a stack overflow, and now we can begin tweening!

--: RunningTransitionHandler

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid : Humanoid = Character:WaitForChild("Humanoid") --: To make IntelliSense actually work, we use the Humanoid : Humanoid figure, when we list a variable, you can use the ':' to show what class it is (e.g: "local variable : bool = true")

local TweenService = game:GetService("TweenService")

local WalkingSpeed = 16
local RunningSpeed = 32

Humanoid.Running:Connect(function(Speed)
	if Speed >= 1 and Humanoid.FloorMaterial or Speed > 0 and Humanoid.FloorMaterial ~= Enum.Material.Air then
		--: We have began to walk
		print("Transition begin")
		TweenService:Create(Humanoid, TweenInfo.new(1), {WalkSpeed = RunningSpeed}):Play()
	else
		--: We have stopped walking
		print("Transition end")
		TweenService:Create(Humanoid, TweenInfo.new(1), {WalkSpeed = WalkingSpeed}):Play()
	end
end)

And now we should have created our transitioning walking speed! Thanks for reading!

Outroduction

I’m completely open for suggestions or criticism, so if you have anything you would like to add, go ahead! <3

7 Likes

Sorry if I am blind and theres actually a reason, but I believe RunService shouldnt be defined as its never used in the script. Though, i’d recommend defining TweenService. Still, overall great tutorial.

Could we have a video for this for those that currently can’t try this out?

Sorry! That was from a mark of my mistake from the original code, since at first I completely forgot about it-

Of course!


Hopefully that shows how it works- my PC is not good with recording :sob:

1 Like

atleast your pc can be at windows 11

what recording program u use and whats ur settings

Yeah, although it is considered to be even more spyware than Windows 11- let’s not delve into that topic, though.

I use OBS Studio. I haven’t changed my settings recently, so that could be why.

Here’s a screenshot of my settings because they are too long for me to be bothered to write down right now: