Advertisement
imtie

Some roblox Vault Function to cure my depression

Feb 12th, 2024 (edited)
1,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | Source Code | 0 0
  1. ---some local script function on pastebin because my PC is unavailable. It might not work, I haven't tested (wonder why)
  2.  
  3. ----Services
  4. local TweenService = game:GetService("TweenService")
  5. local InputService = game:GetService("UserInputService")
  6. ----Debounces
  7. local VaultDB = false
  8. ----Instances
  9. local Player = game.Players.LocalPlayer
  10. local Char = Player.Character
  11. local Root,Head,Hum = Char.HumanoidRootPart,Char.Head,Char.Humanoid
  12. ---- Function
  13. local function Vault()
  14.     if VaultDB == false then
  15.        VaultDB = true
  16.        
  17.         --- raycasting RAHHHHHHHH!!!
  18.         local raycastParams = RaycastParams.new()
  19.     raycastParams.FilterDescendantsInstances = {Char}
  20.     local raycastOrigin = Root.CFrame.Position
  21.     local raycastDirection = Root.CFrame.LookVector
  22.     local raycastLength = 1
  23.    
  24.     local result = workspace:Raycast(raycastOrigin, raycastDirection * raycastLength, raycastParams)
  25.         if result then
  26.             -- Not a character or ToolHandle, no riding allowed!!!
  27.             if result.Instance.Parent:FindFirstChild("Humanoid") == nil and result.Instance.Name ~=  "Handle" then
  28.                 local Part = result.Instance
  29.                if Head.Position.Y > Part.Position.Y + Part.Size/2 then
  30.             ----Tween
  31. local VaultTweenInf = TweenInfo.new(0.2, Enum.EasingStyle.Linear,Enum.EasingDirection.In)
  32. local VaultTween = TweenService:Create(Root,VaultTweenInf, {CFrame = Root.CFrame * CFrame.new(0,3,1) })
  33.     Root.Anchored = true    
  34.                 VaultTween:Play()
  35.                 task.wait(0.2)  
  36.                 Root.Anchored = false    
  37.                     end
  38.                    
  39.              end
  40.            
  41.          end
  42.         VaultDB = false
  43.        end
  44.    
  45.     end
  46.  
  47. InputService.InputBegan:Connect(function(input, GameProcessed)
  48.     if not GameProcessed then
  49.        if input.Keycode == Enum.Keycode.Space then
  50.     if Hum.FloorMaterial == Enum.Material.Air and Hum.Health > 0 then
  51.                     Vault()
  52.              end
  53.                
  54.        end
  55.     end
  56. end)
  57.  
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement