Improvements on wallrunning and walljumping System

*Recently my friend helped make a walljump system that is similar to fe2

Provide an overview of:

  • the code basically checks if the humanoidrootpart was hit and checks if it has a tag called "_Wall or “_Run”, but I am not satisfied with the jump angle and jump velocity that inherits from a attribute in _Wall/ _Run

  • I considered trying to modify a wallrun and jump angle modifier

  • I want modify the jump angle with an attribute under an object value called “_Run”

Here is a video of my wall jumping system,

this is the code of the wall jump system

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

local Sound = Instance.new("Sound")
Sound.Volume = 2
local AttachURL = "rbxasset://sounds/action_jump.mp3"
local LandUrl = "rbxasset://sounds/action_jump_land.mp3"


local chararacter = script.Parent :: Model?
local RootPart = chararacter:WaitForChild("HumanoidRootPart") :: BasePart?
local humanoid = chararacter:WaitForChild("Humanoid") :: Humanoid?

local WallAnim = humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations.WallJump)

local lastJump = tick()

RootPart.Touched:Connect(function()
	local Raycast = workspace:Raycast(RootPart.Position, RootPart.CFrame.LookVector * 1.7)
	
	if Raycast then
		if Raycast.Instance:IsA("Part") and Raycast.Instance:HasTag("Walljump") and tick() - lastJump > 0.1 then
			local normal = Raycast.Normal
			local Hit = Raycast.Instance

			WallAnim:Play()
			Sound.SoundId = AttachURL
			Sound:Play()
			
			RootPart.Anchored = true
			RootPart.CFrame = CFrame.new(RootPart.Position, RootPart.Position + normal)
			
			local Jumped = false
			local begin = tick()
			
			task.spawn(function()
				UserInputService.JumpRequest:Wait()
				Jumped = true
			end)
			
			repeat
				task.wait()
			until Jumped
			
			lastJump = tick()
			RootPart.Anchored = false
			
			Sound.SoundId = LandUrl
			Sound:Play()
				
			if not Hit:GetAttribute("JumpAngle") then
				RootPart.AssemblyLinearVelocity = Vector3.new(
					normal.X * (humanoid.WalkSpeed * 4),
					200 * normal.Y + humanoid.JumpPower + 10,
					normal.Z * (humanoid.WalkSpeed * 4)
				)
					WallAnim:Stop()
				else
				RootPart.AssemblyLinearVelocity = Vector3.new(
					normal.X * (humanoid.WalkSpeed * 2.55),
					50 * normal.Y + humanoid.JumpPower + math.rad(math.deg(Hit:GetAttribute("JumpAngle"))),
					normal.Z * (humanoid.WalkSpeed * 2.55)
				)
				WallAnim:Stop()
			end
		end
	end
end) 

Try this :slight_smile:

RootPart.Touched:Connect(function()
	local Raycast = workspace:Raycast(RootPart.Position, RootPart.CFrame.LookVector * 1.7)
	
	if Raycast then
		if Raycast.Instance:IsA("Part") and Raycast.Instance:HasTag("Walljump") and tick() - lastJump > 0.1 then
			local normal = Raycast.Normal
			local Hit = Raycast.Instance

			WallAnim:Play()
			Sound.SoundId = AttachURL
			Sound:Play()
			
			RootPart.Anchored = true
			RootPart.CFrame = CFrame.new(RootPart.Position, RootPart.Position + normal)
			
			local Jumped = false
			local begin = tick()
			
			task.spawn(function()
				UserInputService.JumpRequest:Wait()
				Jumped = true
			end)
			
			repeat
				task.wait()
			until Jumped
			
			lastJump = tick()
			RootPart.Anchored = false
			
			Sound.SoundId = LandUrl
			Sound:Play()
				
			-- Apply custom jump angle modifier based on attributes
			local jumpAngle = Hit:GetAttribute("JumpAngle") or 45 -- Default to 45 degrees if attribute is missing
			local runAngleModifier = Hit:FindFirstChild("_Run") and Hit._Run:GetAttribute("RunAngleModifier") or 1
			
			local jumpVelocityMultiplier = 4
			local angularVelocityMultiplier = 200

			-- Modify jump velocity based on custom jump angle and run modifier
			RootPart.AssemblyLinearVelocity = Vector3.new(
				normal.X * (humanoid.WalkSpeed * jumpVelocityMultiplier),
				(angularVelocityMultiplier * normal.Y + humanoid.JumpPower) * math.rad(jumpAngle) * runAngleModifier,
				normal.Z * (humanoid.WalkSpeed * jumpVelocityMultiplier)
			)
			
			WallAnim:Stop()
		end
	end
end)
1 Like

I think it works now. Also I found a way to modify the jump velocity with a given attribute.
It really works when adding more flexibility and modifications to jump angle.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.