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

How to make my dash script look smoother?

Asked by 5 years ago

I made a dash script that works by tweening the player 30 studs forward, but if u jump and then dash while your in the air, the dash still works but you go downwards a TINY bit making it jittery, it just looks shaky and weird.

How would u advise i go about stopping the character from moving downwards while dashing??

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

There's no code here so I can't revise it for you, however, considering you're using a tween, when you created the tween, it has a set goal position, when you jump, you've raised your y-axis by a set amount, which the tween is trying to compensate for.

Considering this, I would advise you to create two tweens, then have an if-then clause to check if the player is jumping, if they are, then the second tween should be played, else, the first tween.

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1) -- Time for the Tween to occur

local player = game.Players.LocalPlayer
local y = player.Character.HumanoidRootPart.Position.Y

local goal1 = {}
local goal2 = {}
goal1.CFrame = player.Character.HumanoidRootPart.CFrame + Vector3.new(30, 0, 0)
goal2.CFrame = player.Character.HumanoidRootPart.CFrame + Vector3.new(30, -y, 0)
local center = player.Character.HumanoidRootPart

local tween1 = TweenService:Create(center, tweenInfo, goal1)
local tween2 = TweenService:Create(center, tweenInfo, goal2)

function Activate()
    if player.Character.Humanoid.Jump = false then
        tween1:Play()
    elseif player.Character.Humanoid.Jump = true then
        tween2:Play()
    end
    wait(1) -- Same as TweenInfo
end

Event:Connect(Activate) -- Whatever the Event is

This is an example script

0
Thank you, ill try doing that when i can get on my pc <3 snaplegs 6 — 5y
Ad

Answer this question