Wallclimb script not working?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    a working wallclimb script.
  2. What is the issue? Include screenshots / videos if possible!
    it doesnt work, and i cant find the issue.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i looked everywhere, nothing helped me.

the script

local UIS = game:GetService("UserInputService")
local character = script.Parent
local player = game.Players.LocalPlayer
local humanoid = character:WaitForChild("Humanoid")

local HumRoot = character:WaitForChild("HumanoidRootPart")

local Animation = Instance.new ("Animation")
Animation.AnimationId = "rbxassetid://5940725935"

local Anim = humanoid:LoadAnimation (Animation)

local hasWallRan = false
local LastRun = tick()

function getwall()
	local direction = HumRoot.CFrame.LookVector * 5

	local ray = Ray.new(HumRoot.Position, direction)

	local part = game.Workspace:FindPartOnRay(ray, character)
	return part
end

function jumpRequest ()

	if tick - LastRun >= .2 then
		if humanoid:GetState() == Enum.HumanoidStateType.Freefall and not hasWallRan and getwall{} then
			hasWallRan = true
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			Anim:Play{}
			wait(2)
			if getwall() then
				humanoid:ChangeState{Enum.HumanoidStateType.Jumping}
			end
		end
	end
end

humanoid.StateChanged:Connect(function(old, new)

	if new == Enum.HumanoidStateType.Landed then
		hasWallRan = false
	end

	if new == Enum.HumanoidStateType.Jumping then
		LastRun = tick()
	end
end)

UIS.JumpRequest:Connect(jumpRequest)

First problem:
On line 27 you need to change tick to tick() because any function without brackets just returns the pointer to the function instead of the result that the function would give you
Second problem:
On line 34 you need to replace the curly brackets with parentheses because using curly brackets sends a table as a parameter instead of a single value and Humanoid:ChangeState() doesn’t accept a table as a parameter

1 Like

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