--========================================================
-- MOVEMENT SYSTEM + KEYBIND UI
--
-- F     = ENABLE WALLHOP
-- E     = DISABLE WALLHOP
-- SPACE = WALLHOP
-- C     = SLIDE
-- Q     = INFINITE AIR JUMP
--
-- LocalScript
-- Put inside:
-- StarterPlayer > StarterPlayerScripts
--========================================================

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer

--========================================================
-- WALLHOP SETTINGS
--========================================================

local wallHopEnabled = false

local WALL_DISTANCE = 3.5
local WALL_JUMP_POWER = 55
local WALL_PUSH = 14
local WALL_JUMP_COOLDOWN = 0.10

local FLIP_ANGLE = 70
local FLIP_TIME = 0.10

--========================================================
-- SLIDE SETTINGS
--========================================================

local SLIDE_SPEED = 65
local SLIDE_DURATION = 1.0
local SLIDE_COOLDOWN = 0.8

local lastSlide = 0
local sliding = false

--========================================================
-- INFINITE AIR JUMP SETTINGS
--========================================================

local INFINITE_JUMP_POWER = 55

--========================================================
-- CHARACTER
--========================================================

local character
local humanoid
local root

local lastWallJump = 0

local currentTilt = 0
local tiltConnection

local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude

local function setupCharacter(char)

	character = char

	humanoid = char:WaitForChild("Humanoid")
	root = char:WaitForChild("HumanoidRootPart")

	rayParams.FilterDescendantsInstances = {
		character
	}

	lastWallJump = 0
	lastSlide = 0
	sliding = false
	currentTilt = 0

end

setupCharacter(
	player.Character or player.CharacterAdded:Wait()
)

player.CharacterAdded:Connect(function(char)
	setupCharacter(char)
end)

--========================================================
-- KEYBIND UI
--========================================================

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "MovementKeybinds"
screenGui.ResetOnSpawn = false
screenGui.IgnoreGuiInset = true
screenGui.Parent = player:WaitForChild("PlayerGui")

local keybindLabel = Instance.new("TextLabel")
keybindLabel.Name = "Keybinds"
keybindLabel.Parent = screenGui

-- Bottom-left position
keybindLabel.AnchorPoint = Vector2.new(0, 1)
keybindLabel.Position = UDim2.new(
	0,
	18,
	1,
	-18
)

keybindLabel.Size = UDim2.new(
	0,
	260,
	0,
	130
)

keybindLabel.BackgroundTransparency = 1

-- White text
keybindLabel.TextColor3 = Color3.fromRGB(
	255,
	255,
	255
)

keybindLabel.TextSize = 18
keybindLabel.Font = Enum.Font.GothamMedium

keybindLabel.TextXAlignment =
	Enum.TextXAlignment.Left

keybindLabel.TextYAlignment =
	Enum.TextYAlignment.Bottom

keybindLabel.TextWrapped = true

keybindLabel.Text =
	"F  -  Enable Wallhop\n" ..
	"E  -  Disable Wallhop\n" ..
	"SPACE  -  Wallhop\n" ..
	"C  -  Slide\n" ..
	"Q  -  Infinite Jump"

--========================================================
-- WALL DETECTION
--========================================================

local function getWall()

	if not character or not root then
		return nil
	end

	rayParams.FilterDescendantsInstances = {
		character
	}

	local origin = root.Position

	local directions = {

		root.CFrame.LookVector,
		-root.CFrame.LookVector,

		root.CFrame.RightVector,
		-root.CFrame.RightVector,

		(root.CFrame.LookVector +
			root.CFrame.RightVector).Unit,

		(root.CFrame.LookVector -
			root.CFrame.RightVector).Unit,

		(-root.CFrame.LookVector +
			root.CFrame.RightVector).Unit,

		(-root.CFrame.LookVector -
			root.CFrame.RightVector).Unit
	}

	for _, direction in ipairs(directions) do

		local result = workspace:Raycast(
			origin,
			direction * WALL_DISTANCE,
			rayParams
		)

		if result then

			if math.abs(result.Normal.Y) < 0.5 then
				return result
			end

		end

	end

	return nil
end

--========================================================
-- BODY FLICK
--========================================================

local function doBodyTilt()

	if not root then
		return
	end

	if tiltConnection then
		tiltConnection:Disconnect()
		tiltConnection = nil
	end

	currentTilt = 0

	local startTime = os.clock()

	tiltConnection =
		RunService.RenderStepped:Connect(function()

			if not root or not root.Parent then

				if tiltConnection then
					tiltConnection:Disconnect()
					tiltConnection = nil
				end

				return
			end

			local elapsed =
				os.clock() - startTime

			if elapsed < FLIP_TIME then

				local alpha =
					elapsed / FLIP_TIME

				alpha =
					alpha * alpha *
					(3 - 2 * alpha)

				currentTilt =
					math.rad(FLIP_ANGLE) * alpha

			else

				local returnAlpha =
					math.clamp(
						(elapsed - FLIP_TIME) /
							FLIP_TIME,
						0,
						1
					)

				returnAlpha =
					returnAlpha * returnAlpha *
					(3 - 2 * returnAlpha)

				currentTilt =
					math.rad(FLIP_ANGLE) *
					(1 - returnAlpha)

				if returnAlpha >= 1 then

					currentTilt = 0

					tiltConnection:Disconnect()
					tiltConnection = nil

					return
				end

			end

			root.CFrame =
				root.CFrame *
				CFrame.Angles(
					currentTilt,
					0,
					0
				)

		end)
end

--========================================================
-- WALL JUMP
--========================================================

local function wallJump()

	if not wallHopEnabled then
		return
	end

	if not humanoid or not root then
		return
	end

	if humanoid.Health <= 0 then
		return
	end

	if os.clock() - lastWallJump <
		WALL_JUMP_COOLDOWN then
		return
	end

	local wall = getWall()

	if not wall then
		return
	end

	lastWallJump = os.clock()

	local normal = wall.Normal

	humanoid:ChangeState(
		Enum.HumanoidStateType.Jumping
	)

	root.AssemblyLinearVelocity =
		Vector3.new(
			normal.X * WALL_PUSH,
			WALL_JUMP_POWER,
			normal.Z * WALL_PUSH
		)

	doBodyTilt()

end

--========================================================
-- SLIDE
--========================================================

local function slide()

	if not character or not humanoid or not root then
		return
	end

	if humanoid.Health <= 0 then
		return
	end

	if os.clock() - lastSlide <
		SLIDE_COOLDOWN then
		return
	end

	if humanoid.FloorMaterial ==
		Enum.Material.Air then
		return
	end

	local moveDirection =
		humanoid.MoveDirection

	if moveDirection.Magnitude < 0.1 then
		return
	end

	lastSlide = os.clock()
	sliding = true

	local oldAutoRotate =
		humanoid.AutoRotate

	humanoid.AutoRotate = false

	local startTime = os.clock()

	while os.clock() - startTime <
		SLIDE_DURATION do

		if not character or
			not humanoid or
			not root then
			break
		end

		if humanoid.FloorMaterial ==
			Enum.Material.Air then
			break
		end

		local elapsed =
			os.clock() - startTime

		local alpha =
			math.clamp(
				elapsed / SLIDE_DURATION,
				0,
				1
			)

		local smooth =
			1 - (alpha * alpha)

		local speed =
			SLIDE_SPEED * smooth

		root.AssemblyLinearVelocity =
			Vector3.new(
				moveDirection.X * speed,
				root.AssemblyLinearVelocity.Y,
				moveDirection.Z * speed
			)

		RunService.RenderStepped:Wait()

	end

	if humanoid and humanoid.Parent then
		humanoid.AutoRotate = oldAutoRotate
	end

	sliding = false

end

--========================================================
-- INFINITE AIR JUMP
--========================================================

local function infiniteJump()

	if not character or
		not humanoid or
		not root then
		return
	end

	if humanoid.Health <= 0 then
		return
	end

	if humanoid.FloorMaterial ~=
		Enum.Material.Air then
		return
	end

	local velocity =
		root.AssemblyLinearVelocity

	root.AssemblyLinearVelocity =
		Vector3.new(
			velocity.X,
			INFINITE_JUMP_POWER,
			velocity.Z
		)

	humanoid:ChangeState(
		Enum.HumanoidStateType.Jumping
	)

end

--========================================================
-- INPUT
--========================================================

UserInputService.InputBegan:Connect(function(
	input,
	gameProcessed
)

	if gameProcessed then
		return
	end

	-- F = ENABLE WALLHOP
	if input.KeyCode == Enum.KeyCode.F then

		wallHopEnabled = true

		print("WALLHOP ENABLED")

		return
	end

	-- E = DISABLE WALLHOP
	if input.KeyCode == Enum.KeyCode.E then

		wallHopEnabled = false

		print("WALLHOP DISABLED")

		return
	end

	-- SPACE = WALLHOP
	if input.KeyCode == Enum.KeyCode.Space then

		if wallHopEnabled then
			wallJump()
		end

		return
	end

	-- C = SLIDE
	if input.KeyCode == Enum.KeyCode.C then

		if not sliding then
			task.spawn(slide)
		end

		return
	end

	-- Q = INFINITE AIR JUMP
	if input.KeyCode == Enum.KeyCode.Q then

		infiniteJump()

		return
	end

end)
Universal Script 🎭
undefined Auto wallhop script & more
737views
3 months ago

Auto wallhop script & more

Author
User Avatar
14vnico
Status
Working
Price
Free

Description

Features are at bottom left of screen

[PC ONLY BTW]

Features

1
  • Auto wallhop & more!

Related Scripts