Wall jump walls?

So basically, what I’ve been trying to do is to replicate Flood Escape 2’s wall jump walls.

https://twitter.com/Crazyblox_/status/905397948774830080

As you can see, when the player touches the wall (I guess using touched event) the player sticks onto the wall presumably using attachments and weld constraints or just cframing? Then when the player decides to press the jump key, it launches the player forward. (Or if you wait on the wall for too long then it drops you)

local UserInputService = game:GetService("UserInputService")
local touched = false

script.Parent.Touched:Connect(function(Hit)
	if not touched then
		
	touched = true
	local weld = Instance.new("WeldConstraint")
	weld.Parent = workspace
	weld.Part0 = script.Parent
	weld.Part1 = Hit.Parent:FindFirstChild("HumanoidRootPart")
	end
end)

function onJumpRequest()
	weld:Destroy()
	local hum = Hit.Parent:FindFirstChild("Humanoid")
	hum:ChangeState(Enum.HumanoidStateType.Jumping)
	touched = false
	end

UserInputService.JumpRequest:connect(onJumpRequest)

What I tried doing was putting a script inside a part so that only that part is where you can wall jump. Then used a touch event to do some constraints and stuff.

Issues I ran into of course were the fact that onJumpRequest doesnt work since it cant find weld.
Another one is that using the weldconstraint just makes the player float away from the wall instead of on the wall.

Any way to do this better? Thanks :stuck_out_tongue:

10 Likes

It can’t find weld because weld is a local variable.

You created weld in the touched connection using

	local weld = Instance.new("WeldConstraint")

Which means that other functions can’t see the variable ‘weld’.
Either make the variable global (not recommended), or just do a FindFirstChildOfClass on HumanoidRootPart to find the weld (this is better)

4 Likes

Thanks for telling me that! Though, anyway to make the weldconstraint better or a better alternative so that I could play animations on the wall?

1 Like

I haven’t really used constraints much. Standard welds are way simpler to use, imo (though I think they might be deprecated in favor of WeldConstraints)

Playing animations is unrelated to how you weld - as long as you only weld/anchor HumanoidRootPart, you can play animations by calling Humanoid:LoadAnimation(animation_track) and then calling :Play() on the returned value.

What I meant was to play the animation that shows the player holding onto the wall instead of just space, (Probs gonna have to use some orinetation thing mah jigs)

Honestly something I’ve been thinking about but, would I still be able to have the player jump up off the wall instead of just dropping down?

1 Like

You can make a wall grip animation, and just play it on the humanoid when you weld. It will look as if the character is gripping the wall, then.

Either way, if you weld or anchor, you will have to emulate jump physics using BodyMovers, as roblox only lets you jump if you are touching the ground (it’s a bit stupid).

Nvm I was wrong apparently you can allow jumping in the air directly from the humanoid. See: Documentation - Roblox Creator Hub

1 Like

Actually, not neccessarily. Forcing the jump makes the player jump in the air:

Edit: Forcing the jump state would also work right? Or would using a bodymover be better. (I want to force to be instant instead of slow like bodymovers I think?)

4 Likes