How to make parts tween forward?

Hello, I’m just wandering how to tween parts forward from their original position, I have a script that might make them go forward but I spawn alot of Models at time and they would all go to a single area together. I just need help on how they can go forward from their spawn.

code of my idea:

local LiftPosition = {CFrame = CFrame.new(-255,Item.Position.Y,Item.Position.Z)*CFrame.Angles(0,0,0)}
2 Likes

Idk if its what your looking for but look vector extends a point by a certain amount of studs

local default = TweenInfo.new(10,Enum.EasingStyle.Linear)
local  ExtendDistance = 900--Studs extended by
local TargetPos = PartToMoveTo.CFrame.LookVector * ExtendDistance
local goal = {}
goal.Position = TargetPos
local tween = TweenService:Create(MovingPart, default, goal)

tween:Play()
3 Likes

The stuff are moving to the same area

1 Like

What is your current script?

1 Like
local item= script.Parent
local TweenService = game:GetService("TweenService")
local TweenStyle = TweenInfo.new(60, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)

local Extended = 350
local target = item.CFrame.XVector * Extended
local goal = {}
goal.Position = target
local TweenUp = TweenService:Create(item,TweenStyle,goal)

TweenUp:Play()
wait(58)
script.Parent:Destroy()

I changed it to an XVector to see what happens

1 Like

The "XVector " Doesn’t exist, just do what I did, CFrame.LookVector, If it works than good, if if doesn’t go in your intended direction or doesn’t work than we can fix it.

1 Like

Yeah, I just changed it to see what happens, also they still move to the same place, I kinda wanted them to move Independently, also what if I change it to a local script?

1 Like
local item= script.Parent
local TweenService = game:GetService("TweenService")
local TweenStyle = TweenInfo.new(60, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)

local Extended = 350
local target = item.CFrame.X * Extended
local goal = {}
goal.CFrame = target
local TweenUp = TweenService:Create(item,TweenStyle,goal)

TweenUp:Play()
wait(58)
script.Parent:Destroy()

Try that, XVector isn’t a property of CFrame but X is.

1 Like

This does work as I wanted it to but TweenService:Create property named ‘Position’ cannot be tweened due to type mismatch (property is a ‘Vector3’, but given type is ‘double’)

1 Like

Change goal.Position to goal.CFrame. If you were changing the position, you would need a position value and not a CFrame value.

1 Like

TweenService:Create property named ‘CFrame’ cannot be tweened due to type mismatch (property is a ‘CoordinateFrame’, but given type is ‘double’)

1 Like

This is what I did if you want to keep the same thing, or possibly fix your issue

local TargetPos2 = Part.CFrame + Part.CFrame.LookVector * ExtendDistance
goal2.Position = Vector3.new(TargetPos2.X,-0,TargetPos2.Z)
1 Like

Try what @Wizard101fire90 said.

1 Like

They all went to the same place again

1 Like

I would recommend you to see that the error gave an error that you have provided a Double value, means a number basically. It is because you are trying to set the CFrame of the model like this

target = item.CFrame.X * Extended

Which obviously will give the X Coordinate (A Number), but you will need to pass a CFrame value to the CFrame property of a model. So how you could frame your code is like:

local item= script.Parent
local TweenService = game:GetService("TweenService")
local TweenStyle = TweenInfo.new(60, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)

local Extended = 350
local goal = {}
goal.CFrame = item.CFrame * CFrame.new(Extended, 0, 0)
local TweenUp = TweenService:Create(item,TweenStyle,goal)

TweenUp:Play()
wait(58)
script.Parent:Destroy()
1 Like

Aight im not sure what to do since the scripts you guys gave would either move to the same place or just sink to the ground, at this time im just testing the Local Scripts

1 Like

for that kind of code we tried, it does not even Tween properly btw.

1 Like

Are you sure you have tried that code itself? It Seems to work fine for me, if you are saying that you tried XVector or that thing, that property doesn’t exist, If this is the case, I would say to try with my code.

1 Like

Alright let me recheck for sure.

1 Like

Just to not be confused, the models are cloned and placed in a random spot and is supposed to go in -255 X

1 Like