i coded it on mobile so its not formatted
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
You are using a NumberValue for leaderstats score instead of an IntValue?
Yes, I am using a number value.
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?
I had it running on the server. I had assumed it was the server because you are looping through all the players and updating the score for each which I didn’t figure you’d have every client doing.
its at 1.24 billion when it stops updating. Did you go to that position? (1, -2.478e9,1)
My server stopped updating when it hit 2147483648. It does have an impact if you try to move your character first also. If you move your character to start at -100000000 it seemed to actually set the Y position to -1000000 and started dropping from there but had already set the score to 100M.
You could probably also run something on the client that would update the characters position on the server every so often but be aware that this could easily be utilized to send fake positions.
I figured that out already. I wanna find a way to do it without a compromise in security (e.g exploiting)
I’ll mark this as a solution even though it has a vulnerability. Anyone else that can reply and suggest how else to fix the vulnerability will be given it
You could save the velocity of the player each heartbeat and once the position stops updating, use it to calculate the new position.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.