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?
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)
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
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
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