So my parkour game has a speed-cap and I can’t really change that. And since the game has a speed-coil. I was wondering if there is a alternate way. Would it be possible to force a speed or give a player a helping-force in their direction?
EDIT1: Such as maybe velocity or something. So I don’t have to change the players actual WalkSpeed.
What do you mean by a speed-cap? How is it being set/stored?
It’s mostly being done in the parkour script, a speed-cap that pretty much limits their speed to say about 20 or so at default.
Heres the main stuff:
self.standSpeed = 20
self.crouchSpeed = 10
self.airSpeed = 25
self.swimSpeed = 20
function moveSet:update(dt)
self._fallTimer = (self:isFalling() and not self._isDiving) and self._fallTimer + dt or 0
self._outOfWaterTimer = not self:isSwimming() and self._outOfWaterTimer + dt or 0
if (self._isDiving) then
self.humanoid.WalkSpeed = self.diveSpeed
elseif (self._isLongJumping) then
self.humanoid.WalkSpeed = self.longJumpSpeed
elseif (self:inAir()) then
self.humanoid.WalkSpeed = self.airSpeed
elseif (self:isSwimming()) then
self:setCrouch(false)
self.humanoid.WalkSpeed = self.swimSpeed
else
self.humanoid.WalkSpeed = self._isCrouching and self.crouchSpeed or self.standSpeed
end
self.physBall:update(dt)
if (self.physBall._floorMaterial == Enum.Material.Water) then
self:cancelDive()
end
self.humanoid:Move(self.humanControl:getWorldMoveDirection(), false)
self._canTilt = not NO_STANCE_CHANGE[self.humanoid:GetState()] and self:isMoving()
self:tiltToMovement(dt)
self:slowFall(dt)
self.particles:setParticleEnabled("airTrail", self:inAir() and ((self._isDiving and not self.physBall.isGrounded) or self._isLongJumping))
self.particles:setParticleEnabled("floorParticle", (not self:inAir() or self._isDiving and self.physBall.isGrounded) and self:isMoving() and not NO_STANCE_CHANGE[self.humanoid:GetState()], "3D")
end
I tried doing this to the last else check, it started to work but it seemed to stop working after a short bit. Any help?
if (self._isDiving) then
self.humanoid.WalkSpeed = self.diveSpeed
elseif (self._isLongJumping) then
self.humanoid.WalkSpeed = self.longJumpSpeed
elseif (self:inAir()) then
self.humanoid.WalkSpeed = self.airSpeed
elseif (self:isSwimming()) then
self:setCrouch(false)
self.humanoid.WalkSpeed = self.swimSpeed
elseif not self.humanoid.Parent:FindFirstChildOfClass("Tool") then
if not self.humanoid.Parent:FindFirstChild("Speed Coil") then
self.humanoid.WalkSpeed = self._isCrouching and self.crouchSpeed or self.standSpeed
end
end