so i tried egomoose’s platformer movement thing
anyways i want to copy the walljump in the game, and well I tried and got a ton of errors…
local function reflect(v, normal)
return -2*v:Dot(normal)*normal + v;
end
function moveSet:wallJump()
local hrpCF = self.hrp.CFrame;
local ray = Ray.new(hrpCF * CFrame.new(0, self.hrp.Size.y/2, 0).p, 4*hrpCF.lookVector);
local hit, pos, normal, material = game.Workspace:FindPartOnRay(ray, self.character);
if not (self.isWallJumpActive and self._canWallJump and self:inAir() and hit and (not self._lastWall or self._lastWall:Dot(normal) < 0)) then
return false;
end
self._isWallJumping = true;
self._canWallJump = false;
self._lastWall = normal;
self._totalWallJumpCount = self._totalWallJumpCount + 1;
self._jumpCount = 0;
self:jump(false);
local move = self.humanoid.MoveDirection;
move = (move:Dot(move) > 0 and move:Dot(normal) < 0) and move or hrpCF.lookVector;
self.humanControl:setMode(Enum.HumanoidControlType.Locked, reflect(move, normal));
local count = self._totalWallJumpCount;
delay(0.2, function()
if (self._totalWallJumpCount == count) then
self._isWallJumping = false;
self._canWallJump = true;
self.humanControl:setMode(Enum.HumanoidControlType.Default);
end
end)
return true;
end
self._isWallJumping = false;
self._canWallJump = true;
self._lastWall = nil;
self._totalWallJumpCount = 0;
self.isWallJumpActive = true;
function moveSet:wallJump()
local hrpCF = self.hrp.CFrame;
local ray = Ray.new(hrpCF * CFrame.new(0, self.hrp.Size.y/2, 0).p, 4*hrpCF.lookVector);
local hit, pos, normal, material = game.Workspace:FindPartOnRay(ray, self.character);
if not (self.isWallJumpActive and self._canWallJump and self:inAir() and hit and (not self._lastWall or self._lastWall:Dot(normal) < 0)) then
return false;
end