Advertisement
Joriangames

WallClimbing

Mar 2nd, 2024
2,496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. -- How To Make WALLCLIMB in Roblox Studio!! by BLOXIANCODE youtube.com/c/BloxianCode
  2. -- Tutorial: https://youtu.be/4vf8wg3rGlg
  3.  
  4. local HumRootPart = script.Parent:WaitForChild("HumanoidRootPart")
  5. local humanoid = script.Parent:WaitForChild("Humanoid")
  6. local char = script.parent
  7. local part = nil
  8.  
  9. local ClimbAnimation = humanoid:LoadAnimation(char.Animate.climb.ClimbAnim)
  10.  
  11. game:GetService("RunService").Heartbeat:Connect(function()
  12.         local params = RaycastParams.new()
  13.         params.FilterDescendantsInstances = {char}
  14.        
  15.         if char:FindFirstChild("LeftFoot") then --checking if player is R15
  16.             local result = workspace:Raycast(char.LeftFoot.Position, HumRootPart.CFrame.LookVector * 1.5, params)
  17.             part = result and result.Instance or nil
  18.         else
  19.             local result = workspace:Raycast(char["Left Leg"].Position, HumRootPart.CFrame.LookVector * 1.5, params)
  20.             part = result and result.Instance or nil
  21.         end
  22.        
  23.         if part then
  24.             HumRootPart.Velocity = Vector3.new(HumRootPart.Velocity.X, 15, HumRootPart.Velocity.Z) --15 is speed
  25.             if humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then
  26.                 humanoid:ChangeState(Enum.HumanoidStateType.Climbing)
  27.             end
  28.            
  29.             if not ClimbAnimation.IsPlaying then
  30.                 ClimbAnimation:Play()
  31.             end
  32.            
  33.         else
  34.             ClimbAnimation:Stop()
  35.         end
  36. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement