I have a nextbot game and I am trying to add a climbing system without it ruining my running system. Whenever I have the climb system it stops my running script and keeps the player walkspeed to 16. How can i fix this while also keeping the climb system? Keep in mind these scripts were from youtube tutorials.
Run LocalScript:
"local TweenService = game:GetService(“TweenService”)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local isrunning = script.Parent:WaitForChild(“canrun”)
local Tween
function HandleWalkSpeed(Char)
local Humanoid = Char:WaitForChild(“Humanoid”)
local HRP = Char:WaitForChild(“HumanoidRootPart”)
Humanoid.WalkSpeed = 10
local cam = workspace.CurrentCamera
local tweenService = game:GetService(“TweenService”)
local animation = Instance.new(“Animation”)
animation.AnimationId = “rbxassetid://124669010607956”
local runny = Humanoid:LoadAnimation(animation)
local debounce = false
Humanoid:GetPropertyChangedSignal(“MoveDirection”):Connect(function()
runny:AdjustSpeed(HRP.Velocity.Magnitude / 35)
if Humanoid.WalkSpeed >= 20 then
if debounce == false then
debounce = true
runny:Play()
end
end
if Humanoid.MoveDirection == Vector3.new(0,0,0) then
local t = tweenService:Create(cam, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70})
t:Play()
Humanoid.WalkSpeed = 10
debounce = false
runny:Stop()
if Tween then
Tween:Cancel()
end
Tween = nil
elseif not Tween then
Tween = TweenService:Create(Humanoid,TweenInfo.new(10, Enum.EasingStyle.Sine, Enum.EasingDirection.Out),{WalkSpeed = 45})
Tween:Play()
local t = tweenService:Create(cam, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 80})
t:Play()
end
end)
end
if Character then
HandleWalkSpeed(Character)
end
Player.CharacterAdded:Connect(function(Character)
HandleWalkSpeed(Character)
end)
Climb LocalScript:
–// LOCAL SCRIPT \–
–// SETTINGS \–
local TiltDegree = 11.25 – Tilt degree when movinglocal RollMutipleSpeed = 1.8 – Amount of speed to multiply when roll
local RunSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed – Amount of speed when run–// SERVICES \–
– Get needed services
local UserGameSettings = UserSettings():GetService(“UserGameSettings”)
local Players = game.Players
local UserInputService = game:GetService(“UserInputService”)
local TweenService = game:GetService(“TweenService”)
local RunService = game:GetService(“RunService”)–// VARIABLES \–
local Player = Players.LocalPlayer – Get local player
local Character = Player.Character or Player.CharacterAdded:Wait() – Get player character
local DefaultC0 = Character:WaitForChild(“HumanoidRootPart”):FindFirstChildWhichIsA(“Motor6D”).C0 – Get root hip C0 when not moving
local Humanoid = Character:WaitForChild(“Humanoid”)local Idling = true – A variable to tell if the character is doing specific action
local Holding = false – A variable to tell if the character is holding the edge
local Running = false – A variable to tell if the character is running
local Moving = false – A variable to tell if the character is moving
local Rolling = false – A variable to tell if the character is rolling– A variable stores the current tilt of the character X, Y axes
local Orientation = {
[“X”] = 0; – Current tilt of the character X axis
[“Y”] = 0; – Current tilt of the character Y axis
}– A variable stores tilt info of each input that makes the character move
local moveInput = {
– [Input Keycode] = {“Axis”, + or - direction};
[Enum.KeyCode.W] = {“X”, 1};
[Enum.KeyCode.S] = {“X”, -1};
[Enum.KeyCode.D] = {“Y”, -1};
[Enum.KeyCode.A] = {“Y”, 1};
}– A variable stores all the needed animation id
local Animations = {
– [“Name”] = “Animation Id”;
[“Hold”] = “rbxassetid://92471380767680”;
[“Run”] = “rbxassetid://124669010607956”;
[“Roll”] = “rbxassetid://118368396876097”;
[“Climb”] = “rbxassetid://81989787278218”
}–// FUNCTIONS \–
UserGameSettings.RotationType = Enum.RotationType.CameraRelative
– Make the character face in the direction the camera is facing– Set up animations, easier to play, stop animation
for name, id in pairs(Animations) do – Get animation name, id from each variable in “Animations” table
local anim = Instance.new(“Animation”) – Create an animation
anim.AnimationId = id – Set the animation id
Animations[name] = Humanoid:LoadAnimation(anim) – Set the variable to the animation which we loaded
endfunction CharacterTween(Direction, InputState)
– CharacterTween function, with needed variables (tile info of the input in moveInput table, input state)if not Character.HumanoidRootPart:FindFirstChildWhichIsA(“Motor6D”) then return end – If not find root hip then end function
if Direction == nil then return end – If tile info of the input is nil, end the function
if InputState == “Began” and not Holding then – If input state is began, and character is not holding the edge
Orientation[Direction[1]] = TiltDegree * Direction[2] – Change orientation info
else – Else if input state is ended
if Orientation[Direction[1]] == TiltDegree * Direction[2] or not Idling then – If conditions are met
Orientation[Direction[1]] = 0 – Reset orientation info
end
endlocal info = TweenInfo.new(0.3, Enum.EasingStyle.Linear)
local HandledC0 = DefaultC0 * CFrame.Angles(math.rad(Orientation.X), math.rad(Orientation.Y), 0)
TweenService:Create(Character.HumanoidRootPart:FindFirstChildWhichIsA(“Motor6D”), info, {C0 = HandledC0}):Play()
– Tween character according orientation info we set up
endfunction Roll() – Roll function
if Humanoid.MoveDirection == Vector3.new(0,0,0) or not Idling then return end
– If character is not moving or character is doing specific action then end the functionIdling = false – Set up the variable, to tell the character is doing specific action
Rolling = true– Make the character move faster when rolling
if Running then – If character is running
Humanoid.WalkSpeed = RunSpeed * RollMutipleSpeed – With run speed
else
Humanoid.WalkSpeed = RunSpeed * RollMutipleSpeed – Without run speed
endUserGameSettings.RotationType = Enum.RotationType.MovementRelative
– Make the character face in the direction the character is movingAnimations.Roll:Play() – Play roll animation
Animations.Roll.Stopped:Wait() – Wait until roll animation ended– Reset character walk speed
if Running then – If character is running
Humanoid.WalkSpeed = RunSpeed – With run speed
else
Humanoid.WalkSpeed = RunSpeed – Without run speed
endUserGameSettings.RotationType = Enum.RotationType.CameraRelative
– Make the character face in the direction the camera is facingIdling = true – Set up the variable, to tell the character is not doing specific action
Rolling = false
endfunction Jump() – Jump function
if not Holding then return end – If the character is not holding the edge then end function
Holding = false – Set up the variable, to tell the character is no longer holding the edgelocal BodyVelocity = Instance.new(“BodyVelocity”, Character.HumanoidRootPart) – Create a body velocity
BodyVelocity.MaxForce = Vector3.new(1,1,1) * math.huge – Set max force
BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 10 + Vector3.new(0, 30, 0) – Set velocityCharacter.HumanoidRootPart.Anchored = false – Set humanoid root part anchored to false
Humanoid.AutoRotate = true – Set character humanoid auto rotate to trueAnimations.Hold:Stop() – Stop hold animation
Animations.Climb:Play() – Play climb animation
Animations.Climb.Stopped:Wait() – Wait until climb animation endedBodyVelocity:Destroy() – Destroy body velocity
Idling = true – Set up the variable, to tell the character is not doing specific action
endfunction HoldTheEdge() – HoldTheEdge function
Holding = true – Set up the variable, to tell the character is holding the edge
Idling = false – Set up the variable, to tell the character is doing specific actionCharacter.HumanoidRootPart.Anchored = true – Set humanoid root part anchored to true
Humanoid.AutoRotate = false – Set character humanoid auto rotate to falseAnimations.Hold:Play() – Play hold animation
endfunction CheckIfNearTheEdge() – CheckIfNearTheEdge function
if not Character:FindFirstChild(“Head”) then return end – If not find head then end functionlocal LookRay = Ray.new(Character.Head.Position, Character.Head.CFrame.LookVector * 1) – Create a ray
local Part = workspace:FindPartOnRay(LookRay, Character) – Get part on ray
if Part and Idling and not Holding then – If conditions are met
if Character.Head.Position.Y >= Part.Position.Y + (Part.Size.Y / 2) - 1
– If character head is higher than the top of the partand Humanoid.FloorMaterial == Enum.Material.Air -- If character is floating then -- If conditions are met HoldTheEdge() -- Connect HoldTheEdge function endend
endfunction CheckIfRunning() – Run animation
if Running == true and Humanoid.MoveDirection ~= Vector3.new(0,0,0) and Humanoid.WalkSpeed ~= RunSpeed then
if not Rolling then
Humanoid.WalkSpeed = RunSpeed
end
Animations.Run:Play()
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.3, Enum.EasingStyle.Linear), {FieldOfView = 85}):Play()
elseif Running == false or Humanoid.MoveDirection == Vector3.new(0,0,0) then
if not Rolling then
Humanoid.WalkSpeed = RunSpeed
end
Animations.Run:Stop()
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.3, Enum.EasingStyle.Linear), {FieldOfView = 70}):Play()
end
end–// EVENTS \–
UserInputService.InputBegan:Connect(function(input, chat) – When we pressed a key
if chat then return end – If chatting then end the functionif input.KeyCode == Enum.KeyCode.Space then – If the key pressed is the spacebar
return Jump() – Connect Jump function
elseif input.KeyCode == Enum.KeyCode.E then – If the key pressed is the E key
return Roll() – Connect Roll function
elseif input.KeyCode == Enum.KeyCode.LeftShift then – If the key pressed is the left shift key
Running = true
return
endCharacterTween(moveInput[input.KeyCode], “Began”)
– Connect CharacterTween function with the needed input info (tile info of the input in moveInput table, input state)
end)UserInputService.InputEnded:Connect(function(input, chat) – When we finished pressing a key
if chat then return end – If chatting then end the functionif input.KeyCode == Enum.KeyCode.LeftShift then – If the key pressed is the left shift key
Running = true
return
endCharacterTween(moveInput[input.KeyCode], “Ended”)
– Connect CharacterTween function with the needed input info (tile info of the input in moveInput table, input state)
end)RunService.RenderStepped:Connect(function() – Every render step
CheckIfNearTheEdge() – Connect CheckIfNearTheEdge function
CheckIfRunning() – Connect CheckIfRunning function
end)