Need help getting torso y position to replicate past 32 bit integer limit

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to replicate the players position past the 32-bit integer limit

  2. What is the issue? Include screenshots / videos if possible!

LocalPlayer Y position on client isint replicating (to server) past 32-bit limit

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried manually setting the position to -5e9 but it just goes back to -2.147e9
2 Likes

What are you actually trying to achieve here? Even if you just set a Rig to 5 million the physics won’t work correctly let alone going beyond 32-bit integer.

Just wanted to add that the Position is made up of number datatypes so you should be able to set a value accordingly and not be limited by 32-bit integer limit:

The number data type, or double, represents double-precision (64-bit) floating-point numbers. Numbers can range from -1.7 × 10^308 to 1.7 × 10^308 (around 15 digits of precision, positive or negative).

4 Likes

Why is it that you need to position the player past the integer limit? Even before that point, the engines rendering completely breaks down. Other than that, I don’t think there is a way to go past the limit, it’s hard coded.

4 Likes

The game im working on needs it for a leaderstat

3 Likes

I dont need the physics to work properly, just it falling is good enough. The problem here is on the client the position keeps going but on the server its stuck at the 32 bit integer limit. I wanna find a way to replicate this without creating a possible exploit vulnerability.

Do you have a code example of what you are doing to display the problem?

2 Likes

On the server

game:GetService("RunService").Heartbeat:Connect(function()
for i, plr in pairs(game.Players:GetPlayers()) do
local char = plr.Character
local score = plr.leaderstats.score
if char then
local p = char.Torso or char.HumanoidRootPart or char.Head -- this will be where the position is grabbed 
if p then
local abs = math.abs(p.Position.Y) --makes the negative number a positive
if abs > score.Value then
score.Value=abs
end
else
print("no reference for position")
end
end
end
end)
4 Likes

i coded it on mobile so its not formatted

2 Likes

The problem is the position updates on the client (the player has a screengui that reads the torso y position) but not in the server when it gets past the 32 bit integer limit

2 Likes

You are using a NumberValue for leaderstats score instead of an IntValue?

2 Likes

Yes, I am using a number value.

1 Like

The problem is the actual torso position property wont change past the 32 bit integer limit but on the client it will

Can you give your code? I need further context on this. Also, there is no way that the torso y position of a HumanoidRootPart, Head, or Torso will get past the 32 bit limit, to test this, can you print out the absolute value of the y position of any of the three parts?

I have already and it still doesnt replicate. On the client it goes up but on the server it doesnt

you can test the game out yourself here

Looking at your code earlier, can you tell me what the score value is?, and again, what does the absolute value of the y position of a HumanoidRootPart, Torso, or Head print out?

The score value is a leaderstat. The absolute value on the SERVER stays at the 32 bit integer limit while on the client goes past the 32 bit integer limit. See for yourself in the game.

I’m thinking that your calculating the scores the wrong way, is it programmed to get the magnitude (distance between two vectors or positions)?

No it literally just takes the torso position and makes it not negative. In the game you fall off the map and the lowest you go is saved as a positive number. When you get to the 32 bit integer limit it just stops updating but you keep going further down (the local player has a stud count and the score count but the score count stops updating at the 32 bit integer limit and so does the characters position (on the server)

So I think what is actually happening here is you are hitting the floating point error issue. Your character gets to a point where your acceleration due to gravity cannot overcome the float point rounding error and thus your character stops moving. That or Roblox just won’t let you get past around -1000000 studs.

So one thing you could do is when you get to that point where the character stops falling you could start adjusting the players Y value in code in relation to what it would be with gravity. I’ve just used a set value of -10 studs in this example but you’d need to come up with a formula due to gravity at that level.

game:GetService("RunService").Heartbeat:Connect(function()
	for i, plr in pairs(game.Players:GetPlayers()) do
		local char = plr.Character
		local score = plr.leaderstats.score
		if char then
			local p = char.Torso or char.HumanoidRootPart or char.Head -- this will be where the position is grabbed 
			if p then
				local abs = math.abs(p.Position.Y) --makes the negative number a positive
				if abs > score.Value then
					score.Value=abs
					if abs >= 1000000 then 
						plr.Character:MoveTo(plr.Character.PrimaryPart.Position + Vector3.new(0, -10, 0))
					end
				end
			else
				print("no reference for position")
			end
		end
	end
end)

I mean it moves on the client but not the server. Would I put this on the server?