Hello, I’ve made a localscript that allows me to “Wall run”, in fact there is just a BodyVelocity to fall slowly.
To detect if the player goes near the wall, i used region3.
local found = false
while wait(1) do
local WallsFolder = game.Workspace:WaitForChild("Walls")
for i,v in pairs(WallsFolder:GetChildren()) do
local player = game.Players.LocalPlayer
local char = player.Character
found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
for _, parts in pairs(parts) do
if parts:FindFirstAncestor(game.Players.LocalPlayer.Name) then
--print("player found")
found = true
break
else
found = false
--print("player not found")
end
end
if found == true then
print("found")
ContextActionService:BindAction("WallJump",function(_,state)
if state == Enum.UserInputState.Begin then
print("ContextActionService")
if v.bounce.Value == true then
print("found2")
char.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
if char.Humanoid:GetState() ~= Enum.HumanoidStateType.Running then
if char.HumanoidRootPart.BodyVelocity.MaxForce == Vector3.new(0,0,0) then
char.HumanoidRootPart.BodyVelocity.MaxForce = Vector3.new(0,1000000,0)
elseif char.HumanoidRootPart.BodyVelocity.MaxForce == Vector3.new(0,1000000,0) then
char.HumanoidRootPart.BodyVelocity.MaxForce = Vector3.new(0,0,0)
v.bounce.Value = false
end
end
end
char.Humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Landed and found == true then
WallRun:FireServer(Vector3.new(0,0,0))
char.HumanoidRootPart.BodyVelocity.MaxForce = Vector3.new(0,0,0)
v.bounce.Value = true
end
end)
end
end, true, Enum.KeyCode.Space)
else
ContextActionService:UnbindAction("WallJump")
char.HumanoidRootPart.BodyVelocity.MaxForce = Vector3.new(0,0,0)
v.bounce.Value = true
end
end
end
This script should detect player detection for each wall, but i only does for one wall
robloxapp-20200714-0027534.wmv (2.0 MB)
As you can see here.