Part not Tweening to exactly where another part's CFrame is

I’ve been trying for just over an hour now to fix it, but I am just stumped.

This is the code to move the part over to the paper (shown in screenshot).

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

while task.wait() do
	for i,v in pairs(workspace:GetDescendants()) do
		if v:HasTag("InSortingRange") then
			part = v
			Arm.Busy.Value = true
			part.Anchored = true
			local MoveTween = ts:Create(Arm, TweenInfo.new(1, Enum.EasingStyle.Linear), {CFrame = part.CFrame})
			MoveTween:Play()
			MoveTween.Completed:Wait()
		end

	end
end

Instead of getting this:

I get this:

The cylinder is supposed to move exactly to where the paper’s CFrame is, but instead it goes about 1 stud over where it’s supposed to. Offsetting the CFrame by one stud messes up the rotation and makes the cylinder lie flat.

Try saving the part’s cframe to a variable?

The problem could be either:

  1. You could be tweening the incorrect instance (which the cylinder is attached to)
  2. The width (In the size property) of the cylinder may not match the cylinder’s actual width
  3. If none of these was the problem, it could be a problem in roblox’s engine

Is the Arm anchored? If it isn’t anchored, is it set to CanCollide off while tweening?

Looks like it tries to get to the right CFrame, but is colliding with the paper therefore it isn’t able to go through it into the correct CFrame.

I see that you’ve anchored the paper so it might be the arm that isn’t anchored. (And set to CanCollide on).

If you don’t want it to have CanCollide off and also not want it anchored, you can also set them to different collision groups and make them not interact with each other.

The arm is anchored and CanCollide is turned off.
image

I still get the same result regardless of how I save the CFrame.

1: The instance is the cylinder
2: I do not even know how that is possible.
3: I tried restarting Studio, still didn’t work. If the engine really is just broken like this, then it’s a massive mistake on Roblox’s end.

Its like how you scale one axis but if the second axis isnt scaled with it, the width won’t
change
(Edit: Oh wait nvm, the point is still in the middle)

Optional:
Try sending the place file with the script tweening the part to your desired position so we could look into what could be the cause of this issue.

By the way, don’t send the place file with the important scripts (like the anti-cheat, game function scripts, etc)

The Place File:
IMP-DevForumVersion.rbxl (94.9 KB)

1 Like

That’s weird… It works perfectly fine for me

And you didn’t change anything at all?

1 Like

I didn’t change anything at all

How is this even possible??
(I updated the file as my original experience)

wait, it works perfectly fine in run mode, but in play testing it doesnt?

It could be a weird engine bug, Can you try lerping the cframe instead?

I get the same result.
IMP-DevForumVersion.rbxl (94.9 KB)

1 Like

Sorry for the very late response, I had some stuff going on
This could be the best possible solution:

while task.wait() do
	for i,v in pairs(workspace:GetDescendants()) do
		if v:HasTag("InSortingRange") then
			Arm.Busy.Value = true
			--v.Anchored = true
			v.Velocity = Vector3.new(0,0,0)
			if (Arm.Position - v.Position).Magnitude <= 0.04 then
				v.Anchored = true
			else
				Arm.CFrame = Arm.CFrame:Lerp(v.CFrame, 0.1)
			end
		end
	end
end

That worked! Thank you! (this is to obey the limit)

1 Like

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