Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make the player "jump" in the direction they are facing?

Asked by 2 years ago

Hi, ive been having a problem where im trying to make an ability for a sword where you jump forward and then slam the ground with body velocity, but the thing is, they can only go in one direction. I've been trying to figure this out for ages and help would be really appreciated!

here is the script in server script service:

game.ReplicatedStorage.BigSword.OnServerEvent:Connect(function(player)
    local char = player.Character
    local sword = char:FindFirstChild("GreatSword")
    wait(1)
    local j2 = game.ServerStorage.jumpfx:Clone()
    j2.Parent = workspace
    j2.Position = char.HumanoidRootPart.Position - Vector3.new(0,2,0)
    local gb = bubble:Clone()
    gb.Parent = workspace
    gb.Position = char.HumanoidRootPart.Position - Vector3.new(0,3,0)
    local tweeninformation = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In)

    local TweenGoal1 = {Size = Vector3.new(16.439, 16.439, 16.439)}

    local TweenGoal2 = {Size = Vector3.new(21.37, 7.12, 20.834)}

    local TweenAnimation1 = TweenService:Create(gb,tweeninformation,TweenGoal1)

    local TweenAnimation2 = TweenService:Create(j2,tweeninformation,TweenGoal2)

    TweenAnimation1:Play()
    TweenAnimation2:Play()
    j2.Rotate.Disabled = false
    gb.jump:Play()
-- this is the part where im having the problem under
    game.ReplicatedStorage.Boom:FireAllClients()
    local char = player.Character
    local sword = char:FindFirstChild("GreatSword")
    local vel = Instance.new('BodyVelocity')
    vel.Parent = char:FindFirstChild("HumanoidRootPart")
    vel.Velocity = char.HumanoidRootPart.Position + Vector3.new(0,0.1,-50)
    vel.MaxForce = Vector3.new(0,10000000000000,10000000000000)
    game.Debris:AddItem(vel,0.6)

I can send the rest of the code if you want, but it isnt really important. Thanks again!

Answer this question