Platform getting manipulated by tween, even when not supposed to?

local ts = game:GetService("TweenService")
local part = script.Parent
local waitTime = 10 

local Info = TweenInfo.new(10,Enum.EasingStyle.Sine,Enum.EasingDirection.In)

local tweenTrack = ts:Create(part,Info,{Position = Vector3.new(-24, 0.5, 506)})
local tweenTrack2 = ts:Create(part,Info,{Position = part.Position})

tweenTrack.Completed:Connect(function()
	task.wait(waitTime)
	tweenTrack2:Play()
end)
tweenTrack2.Completed:Connect(function()
	task.wait(waitTime)
	tweenTrack:Play()
end)
tweenTrack:Play()

The base platform is not where it’s supposed to be. It keeps on moving to random locations and I have no idea why.

put it in a new place but the issue still persists.

Why I guess?

Randomly broke.

MORE INFO DOWN BELOW.

I’m assuming the base platform is that medium stone grey brick? If so, what do you mean by “random locations”? Where is the platform supposed to be?

I do not believe there is enough information to debug. What is the part variable referencing to?

Yes, the platform is the gray brick.
image
the TweenPart is the gray brick, and all the other parts are welded to it.

Should have rephrased it better, but what I mean by “random locations” is that the gray part is not where it should be.

What should be:

What it is:

local part is referring to TweenPart.

Is the platform correctly welded to the part that is tweening and is unanchored?

Any parts that are welded to a tweened part should be unanchored while the tweened part remains anchored. I believe this offset might be caused by weld constraints or motor 6Ds so if you are using them, switch to regular welds. Just note that inserting a weld will move parts to Part0 so make sure you use a plugin like Moon Animator’s easy weld.

Platform is anchored, all instances that is welded to the platform is unanchored and welded.

Platform is the one that is tweening.

Tried to switch, but issue still persists.
image
Use regular welds instead of Motor6D’s, but nothing happened.

Try using weldconstraints. I did the same thing as you in studio using weldconstraints and everything works fine.

Uhh… Used WeldConstraints and the cabin doesn’t even move at all


image
image

There might be a problem in your script then, because when I used yours my welded part didn’t even move and just dropped… I’ll reply again in a few mins.

All your built sections check out.
Like @stealvv stated, there might be something else like your scripts interrupting the movement.

Tested with similar setup and everything worked fine:
image
image

task.wait(4)
game:GetService("TweenService"):Create(script.Parent, TweenInfo.new(10), {CFrame = script.Parent.CFrame * CFrame.new(20, 0, 0)}):Play()

Excuse my spaghetti code.

I used CFrame instead of Position, try this instead and then change some settings.

local ts = game:GetService("TweenService")
local part = script.Parent

local tweeninfo = TweenInfo.new(10,Enum.EasingStyle.Sine,Enum.EasingDirection.In)

local tween1 = ts:Create(part, tweeninfo, {CFrame = CFrame.new(-24, 2.5,506)})
local tween2 = ts:Create(part, tweeninfo, {CFrame = part.CFrame})


tween1.Completed:Connect(function()
	task.wait(10)
	tween2:Play()
end)

tween2.Completed:Connect(function()
	task.wait(10)
	tween1:Play()
end)


tween1:Play()

Please tell me if it doesn’t work! Pretty sure for most tweens people use CFrame as it’s more precise, not sure about it though.

1 Like

This code that uses CFrame worked for me. I think it has something to do with weld constraints not adjusting for position-based movements but they rather adjust for CFrame-based ones.

I believe it was discussed in this topic:
Why are parts that are welded to a tweening part not moving with it? - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like

Yes, it does work! But the platform is spinning for some odd reason.

CFrames are a combined coordinate frame of both position and rotation. To adjust the rotation, multiply the base position CFrame by CFrame.Angles and set whichever value flips the tram the other way using math.rad()

Example:

CFrame = CFrame.new(-24, 2.5,506) * CFrame.Angles(0, math.rad(180), 0)

This code may not rotate the right axis. If this is case, switch the math.rad(180) with one of the other 0’s until you get the desired rotation.

1 Like

I already fixed it. The base part was faced in the wrong direction for some reason, but I appreciate your help a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.