Wall run turns into Wall jumping

Hi,

My wallrun script is working but you are able to wall jump infinitely.
I want to know how I would be able to stop a player from wall jumping the first time they wall run.

Here’s a screenshot:

1 Like

We can’t just hack your account to get the script right? (include the script)

Make it possible to wall run 1-2 times before touching the ground.

1 Like

Yeah, but I didn’t want someone to script it for me. You can see whats happening in the video. I wallrun then I jump to interrupt the wallrun then I wallrun again on the same wall.

I don’t want to show the code, but I’ll show the important bits later (I just woke up)

This is a good solution but I found a better solution.

I can find the previous part and compare it with the part the player wallrunned on.

local PreviousInstance = nil

function Wallrun()	
	local LeftResult = LeftWallCheck()
	local RightResult = RightWallCheck()
	--local FloorResult = FloorCheck()

	if not LeftResult and not RightResult then return end -- needs to go through these casts first.

	if PreviousInstance ~= nil then
		local Result = LeftWallCheck() or RightWallCheck()
		print(PreviousInstance)
		print(Result.Instance)
		-- we can compare these two instances.. for example:
		-- if previousinstance == result.instance and Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
		--     print('cant wallrun, player tried to wallrun on same wall while freefalling.')
	end

	Update = nil

	Update = RunService.RenderStepped:Connect(function(DeltaTime)
		local Result = LeftWallCheck() or RightWallCheck()
		if Result  then
			-- code i dont want to show blaj blah
			PreviousInstance = Result.Instance -- restate previousinstance as result instance
		else
			Update:Disconnect()
		end

		if Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
			print("Disconnected due to grounded")
			Update:Disconnect()
		end
	end)
end


This is not the code, this is just an example

Here is how it works when implemented

	if PreviousInstance ~= nil then
		local Result = LeftWallCheck() or RightWallCheck()
		if PreviousInstance == Result.Instance and Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
			print("Player tried to wallrun while freefalling on previous wall")
			return
		end
	end

function StateChanged(old)
	if old == Enum.HumanoidStateType.Landed then
		PreviousInstance = nil -- only becomes nil when player finally touched the ground
	end
end

Final Result:

1 Like

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