My Vector3's arent behaving like Vector3's

print(game.Workspace.Areas[Area].AreaSelector.Position.Y - ((1 - Ratio) / 2))
AreaData[Area]["Grid"][X][Y]["Instance"].Position = Vector3.new(XPos, game.Workspace.Areas[Area].AreaSelector.Position.Y - ((1 - Ratio) / 2), ZPos)
print(AreaData[Area]["Grid"][X][Y]["Instance"].Position)

I am completely stuck. The Y part of my vector3 just wont work.
The first print statement prints: 3
The second print statement prints: 100, 0, 100
As you can see, the y position of the vector 3 is 0. even though the y argument i supplied is the exact same as the one i supplied to the first print statement.

The exact same thing happens if i use a variable

local aaa = game.Workspace.Areas[Area].AreaSelector.Position.Y - ((1 - Ratio) / 2)
print(aaa)
AreaData[Area]["Grid"][X][Y]["Instance"].Position = Vector3.new(XPos, aaa, ZPos)
print(AreaData[Area]["Grid"][X][Y]["Instance"].Position)

The first print statement prints: 3
the second print statement prints: 100, 0, 100

It feels like i have tried everything. there are no nil variables of any kind and all arguments are supplied correctly. i dont see a reason as to why this shouldnt work normally

Try to use CFrame instead of Vector3

AreaData[Area]["Grid"][X][Y]["Instance"].CFrame = CFrame.new(XPos, game.Workspace.Areas[Area].AreaSelector.Position.Y - ((1 - Ratio) / 2), ZPos)

is it unachored by any chance?

Using CFrame instead of vector3 didnt help. i got the exact same outcome.

is it unachored by any chance?

it is anchored

If it’s a model use :PivotTo

Its not a model, its a normal part

Any weld constraints referencing the part?

No welds or anything that could change the position other than these lines of code

try adding a task.wait before printing the updated position, perhaps it didnt replicate fast enough

Can you show us what your part looks like on Explorer?

Didnt help either.

Can you show us what your part looks like on Explorer?

image

Where are you changing the position? On client?

I am changing the position on the server. The position it moves to also visually moves to the wrong position so i can see ingame that it is actually going to the wrong place.

Have you restarted Studio? This is weird. A part alone should be able to move freely even if it anchored.

Try this:


local node = AreaData[Area]["Grid"][X][Y]["Instance"]
node.Position = Vector3.new(XPos, game.Workspace.Areas[Area].AreaSelector.Position.Y - ((1 - Ratio) / 2), ZPos)
print(node.Position)

Even just doing this:

print(Vector3.new(100, aaa, 100))

prints: 100, 0, 100
even though aaa is set to 3

That didnt work either, and i have tried restarting studio. My friend is also getting this issue

I have partly found the solution. As it turns out, Ratio was an infinitemath number (Infinitemath is a module for numbers bigger than 1e308.) When i printed ratio, it printed 1. Not a table, which is a flaw of infinitemath numbers as it made me to believe it was a normal number. Now i just have to figure out how to convert it into a normal number

1 Like

Can I see your code for this?

For example, try running this code in the cmd bar

local x = 1
print(Vector3.new(100, x, 100))

Doing that did print correctly. I had a fake number in my equation hence why it went wrong

1 Like

You should look into type-checking to prevent these kinds of subtle bugs in the future.

The issue here was that the Vector3 constructor was implicitly coercing your BigNum table into a random number without you knowing, but with type-checking, the editor would’ve warned you ahead-of-time about passing a table in when a number was expected.

1 Like

I looked up the module. If you haven’t, try local realNum = InfiniteMathNum[1] * 10^InfiniteMathNum[2]