Wall Running Help

Hello fellow scripters! I am currently participating in “Gnomejam 2023” and I’ve got like 2 days left before publishing the game. I need help making a wall running system similar to Sonic Frontiers where if you boost on a wall, you can go up the wall, however, I have not made a system like this before. I am willing to learn how to do systems like this, it’s just that I’m lost because there’s no tutorials that I can that give me the information that I need.

Background on the game incase that’s neccessary: The game is inspired by Pizza Tower and the Sonic games.

Here is what I’ve so far managed to achieve, but all of it sucks (since I am so “good” at scripting).

50.26 MB file on MEGA (sorry, you have to download it because I can’t find video to link converters :skull: )

Here is my script

local Player = game:GetService("Players").LocalPlayer

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

local Animations = Character:WaitForChild("NewAnimate")

-- Services

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

local tweenInfo = TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)

local Red = Color3.fromRGB(255,0,0)
local Green = Color3.fromRGB(70,255,0)

local Folder = Instance.new("Folder", game:GetService("Workspace"))

Folder.Name = "RunningAfterImage"

-- Settings

local MaxSpeed = 150
local SpeedGain = 0.5

local WalkAnim = "rbxassetid://11627928652"
local RunAnim = "rbxassetid://12984796699"

local MaxJump = 70
local JumpGain = 0.3

local RayDebounce = false
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.FilterDescendantsInstances = Character:GetChildren()

RunService.Heartbeat:Connect(function()	
	
	if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
		if Humanoid.MoveDirection.Magnitude > 0 then
			Animations:WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = RunAnim
			
			Humanoid.WalkSpeed += SpeedGain
			Humanoid.JumpPower += JumpGain

			if Humanoid.WalkSpeed > MaxSpeed then Humanoid.WalkSpeed = MaxSpeed end
			if Humanoid.JumpPower > MaxJump then Humanoid.JumpPower = MaxJump end

			if Humanoid.WalkSpeed >= 50 then
				
				local RayCast = game:GetService("Workspace"):Raycast(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame.LookVector * 3, RayParams)

				if RayCast and not RayDebounce then
					RayDebounce = true
					
					Character:WaitForChild("HumanoidRootPart").Orientation = Vector3.new(0,90,0)
					
					task.wait()
					
					RayDebounce = false
				end

				for i,v in pairs(Character:GetChildren()) do
					if v:IsA("BasePart") then
						wait(0.3)

						local AfterImage = v:Clone()

						local RandomColor = math.random(1,2)

						AfterImage:ClearAllChildren()

						AfterImage.Parent = Folder				
						AfterImage.CanCollide = false
						AfterImage.Anchored = true
						AfterImage.Transparency = 0.5

						if AfterImage.Name == "Head" then						
							local MeshClone = Character:WaitForChild("Head"):WaitForChild("Mesh"):Clone()
							local HatClone = Character:WaitForChild("Gnome"):Clone()

							MeshClone.Parent = AfterImage
							HatClone.Parent = AfterImage
						end

						if RandomColor == 1 then
							AfterImage.Color = Red
						elseif RandomColor == 2 then
							AfterImage.Color = Green
						end

						TweenService:Create(AfterImage, tweenInfo, {Transparency = 1}):Play()

						Debris:AddItem(AfterImage, 1)
					end
				end
			end
		else
			Animations:WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = WalkAnim
			Humanoid.WalkSpeed = game:GetService("StarterPlayer").CharacterWalkSpeed
			Humanoid.JumpPower = game:GetService("StarterPlayer").CharacterJumpPower
		end
		
	else
		Animations:WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = WalkAnim
		Humanoid.WalkSpeed = game:GetService("StarterPlayer").CharacterWalkSpeed
		Humanoid.JumpPower = game:GetService("StarterPlayer").CharacterJumpPower
	end
	
end)

Edit: I just figured out to just change the Humanoid state to jumping when a raycast intersects with a part

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