script: local UserInputService = game:GetService("UserInputService") local…
- User
script:
local UserInputService = game:GetService("UserInputService") local ContextActionService = game:GetService("ContextActionService") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris") local GuiService = game:GetService("GuiService")
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local camera = workspace.CurrentCamera local humanoid = character:WaitForChild("Humanoid") local rootPart = character:WaitForChild("HumanoidRootPart") local head = character:WaitForChild("Head")
local grabAnim = humanoid:LoadAnimation(game:GetService("ReplicatedStorage"):WaitForChild("Animations"):WaitForChild("Player"):WaitForChild("Grab"))
local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {character} raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local vaultMoveNumber = 10 local canVault = true local canMove = true local vaultConnection = nil
local function partCheck(ledge) local vaultPartCheck = workspace:Raycast(ledge.Position + Vector3.new(0, -1, 0) + ledge.LookVector * 1, ledge.UpVector * 3, raycastParams) return vaultPartCheck == nil end
local function vaultMove(direction) local headCFrame, headRightVector, headLookVector = head.CFrame, head.CFrame.RightVector, head.CFrame.LookVector local moveRay = workspace:Raycast(head.Position, headRightVector * direction + headLookVector * 8, raycastParams)
codeif moveRay or workspace:Raycast(head.Position + Vector3.new(0, -1, 0) + headRightVector * direction, headRightVector * -direction + headLookVector * 2, raycastParams) then endend
local function onMoveDirectionChanged() if not canMove then return end local moveDirection = humanoid.MoveDirection local cameraRightVector = camera.CFrame.RightVector if moveDirection:Dot(cameraRightVector) > .7 and not canVault then vaultMove(vaultMoveNumber) elseif moveDirection:Dot(-cameraRightVector) > .7 and not canVault then vaultMove(-vaultMoveNumber) end end
local function createLedgePart(ledgeOffset) local ledgePart = Instance.new("Part") ledgePart.Parent = workspace ledgePart.Anchored = true ledgePart.Size = Vector3.one ledgePart.CFrame = ledgeOffset + Vector3.new(0, -2, 0) + ledgeOffset.LookVector * -1 ledgePart.CanQuery = false ledgePart.CanCollide = false ledgePart.CanTouch = false ledgePart.Transparency = 1 return ledgePart end
local function performVault(ledgePart, ledgeOffset) canVault = false canMove = false
code - Assistant