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

Moving a model using TweenService?

Asked by 6 years ago

I sorta got stuck in a rut where I can't change my script to not use tweenservice, because other wise I have to redo a large bulk of my script.

So is there a way to tween a model's cframe through the use of tweenservice?

1 answer

Log in to vote
-1
Answered by 6 years ago

Hello,

01local tweenService = game:GetService("TweenService") --Get the tween service.
02 
03local part = Instance.new("Part") --Make a new part.
04part.Position = part.Position --ignore
05part.Anchored = true --Part is anchored.
06part.Parent = game.Workspace --The parent of the part is workspace
07 
08local goal = {} --Table.
09goal.Position = Vector3.new(x,y,z) --Where you want the part to go (world coordinates) (change x y z to coordinates)
10 
11local tweenInfo = TweenInfo.new(4) --Speed (The lower the number the fastest the tween)
12 
13local tween = tweenService:Create(part, tweenInfo, goal) --Give the tween info.
14 
15tween:Play() --Execute the tween.

This is how you move a part

~Frag

Ad

Answer this question