! 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