How I would approach the problem is making the start and goal cframe values
do both cframevalues.changed:connect (the same function)
in that function, restart the tween with current position and time remaining (obviously not tested)
if it is on client, one can lerp with renderstepped/prerender but I guess this is server
thanks, I’ll try this and also I’m going to to tween on client when I’m done
cooked up something rel quick, appears to work… appears to anyways
in a server script I wrote this (sorry its a mess, was in a rush)
wait(1)
local thing = workspace:WaitForChild("Thing")
local A = workspace:WaitForChild("A")
local B = workspace:WaitForChild("B")
local AT = Instance.new("CFrameValue")
AT.Value = A.CFrame
local BT = Instance.new("CFrameValue")
BT.Value = B.CFrame
local starttime = time()
local function newtween()
thing.CFrame = AT.Value:Lerp(BT.Value,time()-starttime)
end
local TS = game:GetService("TweenService")
local goal = {}
goal.Value = workspace:WaitForChild("AG").CFrame
TS:Create(AT,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("AG").CFrame
TS:Create(A,TweenInfo.new(1),goal):Play()
goal = {}
goal.Value = workspace:WaitForChild("BG").CFrame
TS:Create(BT,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("BG").CFrame
TS:Create(B,TweenInfo.new(1),goal):Play()
AT.Changed:Connect(newtween)
BT.Changed:Connect(newtween)
I have realized that in your video, the two parts are perfectly aligned. my smol brain thinks you could get by directly tweeting to the second part’s goal position. However, my method should pass the edge-case scenarios where the goal part is in a weird position
I believe this is how bezier curves work, which is fitting since this kind of looks like bezier curve
hope this meets your needs.
appears to pass all the test cases I can think of
I can’t really tell whats happening in the video, but it needs to be able to move from point A to point B in a model and then have that model also being moved like here (below the text):
the video is pretty clear on my end… not sure what went wrong…
I suppose you can see for yourself by having in workspace part named A, B (the first two part that gets tweend) Thing (the tween that go between A and B)
and AG, BG (the goals for A and B)
This is what it does:
This is what I want it to do:
Yes I know that It looks bad, It takes too much space so I can’t post it easily
Wait I dont understand… so you want it to follow the first part, wait until first part finishes, then begin it’s tween?
Then I don’t see why the previous replies didn’t solve your problem…
I suppose I will modify my script (not tested)
wait(1)
local thing = workspace:WaitForChild("Thing")
local A = workspace:WaitForChild("A")
local B = workspace:WaitForChild("B")
local TS = game:GetService("TweenService")
local goal = {}
goal.CFrame = workspace:WaitForChild("AG").CFrame
TS:Create(A,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("BG").CFrame
TS:Create(B,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("AG").CFrame
local thingtween = TS:Create(thing,TweenInfo.new(1),goal)
thingtween:Play()
thingtween.Complete:Wait()
goal = {}
goal.CFrame = workspace:WaitForChild("BG").CFrame
TS:Create(thing,TweenInfo.new(6),goal):Play()
Sorry if this is complex, I’m just trying to make sure you understand
no, the video shows the button being pressed → both tweening, the one up higher moves the one below which a part inside is also tweening
This image shows the higher one (first model named Move), the the lower one (second model named Move). It also shows the type1,type2, and type4 (Color to check for, which doesn’t matter for this).
The Part (And any other part in the model, that’s not Type,Type2,Type4 (There’s some more, so maybe list) gets moved the distance from type1 to type2 (For example type1 is 0,0,0, type2 is 10,0,0 and the part(s)/model(s) (could be many) is 0,5,0. Now when tweened will move to 10,5,0. Now lets say there’s two tweens (Like the image and video) and the pos the top type1 is 0,0,0, top type2 is 10,0,0, bottom type1 is 0,3,0, bottom type2 is 10,3,0 (Moves second model(s)/parts + 10X and the bottom one moves the model(s)/parts the distance of type1 to type2 (Like earlier and also the type1 and type2 of the scripts parent or wherever the second model is, also not including the children named Type1, Type2, Type3, Type4, (Or any other that I list) that’s in that second model). The instances being tweened for the first Move is all of the descendants (BaseParts) of that model (First model) (Not including the children named Type1, Type2, Type3, Type4, (Or any other that I list)). The second model will do the same thing just appling the things in that model.
1 Like
for models, tween a cframe value, cframe.changed do model:PiviotTo(cframevalue.value)
make sure everything inside the model is anchored
wait until the outside model finish tweeting (tween.Completed:Wait()) then tween the inside model samely
1 Like
I need to be able to tween at any time
why would tweening a model prevent you from tweeting at “any time”? do you mean individual parts inside the model need to tween independently? (as in going off to different directions?)
oh wait I see, so some parts inside the model shouldn’t move…
in that case, remove them from the model when tweening the model? (in other words, creating a model inside the model, which moves, parts not in the model that is in the original model would therefore not move, when tween complete, parent everything back to original model)
I’ll just record you a video or something
roblox is down It might take longer
1 Like
AHHHHH (It’s because I was recording is a wrong format)
not tested but I believe this may work (sorry cant use studio rn)
place the parts in a line like in the video
wait(1)
local thing = workspace:WaitForChild("Thing")
local A = workspace:WaitForChild("A")
local B = workspace:WaitForChild("B")
local AT = Instance.new("CFrameValue")
AT.Value = A.CFrame
local BT = Instance.new("CFrameValue")
BT.Value = B.CFrame
local starttime = time()
local function newtween()
thing.CFrame = AT.Value:Lerp(BT.Value,math.min(1,(time()-starttime)*3))
end
local TS = game:GetService("TweenService")
local goal = {}
goal.Value = workspace:WaitForChild("AG").CFrame
TS:Create(AT,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("AG").CFrame
TS:Create(A,TweenInfo.new(1),goal):Play()
goal = {}
goal.Value = workspace:WaitForChild("BG").CFrame
TS:Create(BT,TweenInfo.new(1),goal):Play()
goal = {}
goal.CFrame = workspace:WaitForChild("BG").CFrame
TS:Create(B,TweenInfo.new(1),goal):Play()
AT.Changed:Connect(newtween)
BT.Changed:Connect(newtween)
I multiplied my original proposed solution lerp alpha by 3, which make the thing go between A and B before A and B finish
I don’t think you understand. So basically it needs to move all descendants of a model (That are not a child named on a certain list) and it can only move the distance from A to B (if A = 0,0,0, B = 5,0,0, and a part is 0,5,0 then the target pos would be 5,5,0.) BUT IF it gets moved by another one the target pos wouldn’t be right so it would need to be updated
I indeed do not understand, so you want the thing to move the relative position of A and B
what I think you are trying to do is (ima make a example) suppose moving A and B is like moving along y = mx + b, and another part with different b will have the same slope of movement m?
in that case the goal position would be thing.Position + (A.Position - B.Position )
and as for tweeting entire models, you can use cframe values and piviot to… hope this is what you are trying to do?