You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to make a dash system where when the player presses E, they get dashed to the left side. I’m using RightVector for this, and if the player dashes in the air, they get flinged to the left side. Script will be shown below 2.
What is the issue? I am not good with sort of CFrame and RightVector stuff, here is the code I have: (the Torso is a HumanoidRootPart Variable. This is also a part in a LocalScript)
Torso.Velocity += Torso.CFrame.RightVector*100
What solutions have you tried so far? I tried looking on different topics and found nothing. I also tried BodyVelocity but it dashes me into wrong directions.
I also kinda need a method that doesn’t dash the player instantly or really fast, as that would look kinda weird.
It’s kind of advanced and I only need a few lines of code for this. Can you find a different method? If it’s not possible, then I might try the one above.
try this
i made both left and right dash velocities and made the code for you
the velocities dont fling my character at all in this code
(Code goes into StarterCharacterScripts located in StarterPlayer) (The script type is a LocalScript)
local char = script.Parent
local rootpart = char.PrimaryPart
local userinputserv = game:GetService("UserInputService")
local rightdashkey = Enum.KeyCode.E
local leftdashkey = Enum.KeyCode.Q
local canRightdash = true
local canLeftDash = true
local debris = game:GetService("Debris")
local sec = 1
local rightforce = 50
local leftforce = -50
userinputserv.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if input.KeyCode == rightdashkey and canRightdash then
if not canLeftDash then return end
canRightdash = false
local velocity = Instance.new("BodyVelocity", rootpart)
velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
velocity.Velocity = rootpart.CFrame.RightVector * rightforce
debris:AddItem(velocity, .5)
task.wait(sec)
canRightdash = true
end
end)
userinputserv.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if input.KeyCode == leftdashkey and canLeftDash then
if not canRightdash then return end
canLeftDash = false
local velocity = Instance.new("BodyVelocity", rootpart)
velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
velocity.Velocity = rootpart.CFrame.RightVector * leftforce
debris:AddItem(velocity, .5)
task.wait(sec)
canLeftDash = true
end
end)
--|| SERVICES ||--
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DashEvent = ReplicatedStorage:WaitForChild("DashEvent")
local Character = script.Parent
local Torso = Character.HumanoidRootPart
local Humanoid = Character:WaitForChild("Humanoid")
local Dash = Humanoid:LoadAnimation(ReplicatedStorage.Animations.Dash)
local Properties = {
-- Velocity = 25,
-- Duration = 0.5,
Keybind = Enum.KeyCode.E,
LastDash = tick(),
Cooldown = 0.01,
}
UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if Input.KeyCode == Properties.Keybind then
if tick() - Properties.LastDash >= Properties.Cooldown then
if Character.En.Value >= 1 then
Properties.LastDash = tick()
DashEvent:FireServer()
Torso.Velocity = Torso.CFrame.RightVector*100 -- remove "+" from "="
game.Players.LocalPlayer.PlayerScripts.En.Value -= 25
else
return false
end
end
end
end)
actually i think this is a qucik thing, let me try your idea
it works! but how would i make original player animations stop beuase i have a dash animation and it makes the animation when i dash look a bit weird. if u can’t do this ill still end up marking urs as sollution
Did you set any animation priority to your animation? if so, it may be the wrong priority, try using the priority called “Action”
If you did not set an animation priority to your animation, then like I said above, use the priority named “Action” and the animation may work without the falling animation overriding it
to set an animation priority, just click the “Set Animation Priority” button when you click the three dots on the right to the name of the animation. it should be below “Create new”
i changed the priority by opening animation editor, changing priority to “action”, and publishing it overriding my current dash animation. would that work?