Issues with tweening and positions being set to extreme values for NO reason

I’m making a game that uses tweens to path objects between waypoints.
There is a very strange bug that occurs if I don’t have obnoxious amounts of waits set around in my script:
Every now and again, when interupting an existing tween, when trying to set a new one the part’s position will go to some extreme negative number under the map.

Someone reported a bug similar to this a while back: TweenService position overflow
But if you take a look at the thread there is zero useful information. I guess bugs/ solutions to bugs are just private info?

I’d like to know what it is that might be causing this issue specifically, because it’s been bothering me for a while.
The waypoints seem to be going to the correct spots, and the tween end position seems to be good.
It seems to be when I start a tween, the position might just set its Y coordinate to -100,000 or something all of a sudden.

Specifically, if I try to set the parts position with a reference to the part’s current position itself, it seems like if the object is mid-tween it returns some kind of “can’t deal with it” number.

ai.CFrame = CFrame.new(ai.Position, Vector3.new(newWayPoint.X, ai.Position.Y, newWayPoint.Z))
2 Likes

Could this be an issue with Roblox’s floating point errors?

I know floating point is imprecise, but what would prompt them to set values to extremely low negative numbers?

Oh I think it has to do with when I’m setting the CFrame to look straight up

FIXED:

The issue wasn’t coming from tweening, it was coming from an error that happens when you try to look straight up/ down with CFrame.new(Vector3, Vector3)
The Y position gets what I presume to be an error and it sets the origin of the Y position in the CFrame to -1000000 (or something extreme like that)

An easy workaround is just checking if the X and Z in the first Vector3 isn’t equal to the X and Z of the second Vector3, then proceeding if it doesn’t.

3 Likes