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

Problem with making a player move forward using tween service?

Asked by
Sorukan 240 Moderation Voter
5 years ago
Edited 5 years ago

I'm trying to use the tween service to smoothly move a player forward a certain amount of studs. I tried using lookVector because the player has to always be moving forward despite whichever direction they're facing.

local tweenInfo = TweenInfo.new(

0.45, -- TweenLength

Enum.EasingStyle.Quint, -- EasingStyle

Enum.EasingDirection.Out, -- EasingDirection

0, -- Repeat

false, -- Revert

0 -- Delay

)

local properties = {

Position = root.CFrame.lookVector + Vector3.new(5,0,0)

}

local tween = tweenService:Create(root,tweenInfo,properties)

tween:Play()

1 answer

Log in to vote
1
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago

You'll need to do:

lua Position = root.Position + (root.CFrame.lookVector * stud_distance)

0
O thanks. I'm still not so good at CFrame so i'll do some more research. Sorukan 240 — 5y
Ad

Answer this question