Add more velocity on top of velocity?

script:


mouse.Button2Up:Connect(function()
	
	player.Character.HumanoidRootPart:ApplyImpulse(player.Character.HumanoidRootPart.Velocity+player.Character.HumanoidRootPart.CFrame.RightVector*1000)
	

end)
while true do 
player.Character.HumanoidRootPart.Velocity =  player.Character.HumanoidRootPart.CFrame.RightVector*40 
end

when added inpulse, it resets quickly after, its because of the while true do loop, how ever if i do something like

while true do 
player.Character.HumanoidRootPart.Velocity = player.Character.HumanoidRootPart.Velocity +player.Character.HumanoidRootPart.CFrame.RightVector*40 
end

it will accelerate because its adding it again and again, how could i make it go forward while maintaining the current velocity?


You're already accomplishing this by using the while loop:

It seems like what youre trying to do is to make it so when you click with your mouse it gives you a boost?

yeah like a dash, i need it to kinda go forward and have the while loop be able to be affected by outside velocity, however it just resets after.

I wouldn’t recommend using Velocity due to it being deprecated, Instead you should use AssemblyLinearVelocity

If the issue is your Char suddenly halting try to find a way to lower the (Friction)

(Example for using AssemblyLinearVelocity)
For the script I’d suggest doing this

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local HRP = Char:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()

Mouse.Button2Up:Connect(function()
	local Velocity = HRP.AssemblyLinearVelocity + HRP.CFrame.LookVector*1000
	HRP:ApplyImpulse(Velocity)
end)

yeah i did that, new code:

mouse.Button2Up:Connect(function()
	game.ReplicatedStorage.RemoteEvent:FireServer("ChargeEnded",charge)
	player.Character.HumanoidRootPart:ApplyImpulse(player.Character.HumanoidRootPart.CFrame.RightVector*1005)
	charge = 0
	held = false

end)
while true do
player.Character.HumanoidRootPart.AssemblyLinearVelocity = player.Character.HumanoidRootPart.CFrame.RightVector*40
end

but it resets to that every time because of the loop, im trying to find a velocity alternative that allows for outside forces

Does outside forces refer to a part hitting the player?

no, theres a constant velocity (the loop), but I am trying to add a dash, which makesit faster, but the problem is, every time i add that velocity, it resets back to the loop. Outside forces is the apply inpulse/dash

you could try using a linearvelocity object instead since the velocity is constant and parent it to the character’s root, and then just increase that velocity when you need to perform a dash

first of all, I tried linear velocity before, it counters gravity, which isn’t good for what I’m doing, Secondly, the dash would be very robotic, I would like a sudden burst of velocity and then go back down to rightvector*40

also linearvelocity doesn’t allow more velocity either (I think)

ah ok what if you used a numbervalue that keeps track of the additional boost and every time the while loop loops, it gets that value and adds it

yeah I tried that before, sadly it just resets after the next loop :sob:

did something like that:

mouse.Button2Up:Connect(function()
	game.ReplicatedStorage.RemoteEvent:FireServer("ChargeEnded",charge)
	dash = 100
	charge = 0
	held = false
	wait()
	dash = 0
end)

and used something like

player.Character.HumanoidRootPart.AssemblyLinearVelocity = player.Character.HumanoidRootPart.CFrame.RightVector*(40+charge)

what about just a conditional that checks to see if a BoolValue is true instead

while true do
	local boosting = game.GetService("whateverpathhereis").BoostValue.Value
	if not boosting then
		player.Character.HumanoidRootPart.AssemblyLinearVelocity = player.Character.HumanoidRootPart.CFrame.RightVector*40
	else
		player.Character.HumanoidRootPart.AssemblyLinearVelocity = player.Character.HumanoidRootPart.CFrame.RightVector*80
	end
end

or at least something along the lines of this

yes but you see, when i activate it, to goes 80, but the NEXT loop, where I’m not activating it, resets it back to 40

one second do you mind if i try this in studio

what about if you tried the numbervalue idea but this time keep it at 80 and slowly decrement it over time so that way it goes back to 40

damn I was trying to avoid thos method, really hacky and artificial, I would like to avoid this unless its the only solution possible

k i understand , im going to try and mess around in studio to see if i can try to find a solution rq

same. I am gonna read into other velocity types