Random.new() giving different results locally?

I’m using Random to make a pseudorandomized dungeon crawler with unique weapon generation. It all works fine on the server, but once I ask it to generate a weapon locally, it gives completely different results every time.


the row of halberds on the left are all generated on the server, but the one halberd to the right was generated locally.


The seed being created and used for random size.
image
prints given

I’m aware of an issue with inconsistancy of generation with negative integers, but even after rounding and giving the absolute value of the resulting seed, it still does this.

To clarify, I’m not really asking for a direct answer on how to fix this. Help would be nice, but I’m moreso asking for knowledge that this issue even exists.

2 Likes

For some reason the loading order of the :GetChildren() pairs loop wasn’t the same locally. I just sorted that table alphabetically and it fixed it. :person_shrugging:

1 Like

How do you sort it? I’ve been wondering because my fall damage mapping didn’t work because of this

2 Likes

you can use:
table.sort(yourtablehere, function(a,b)
return a.Name < b.Name
end)
this will sort the table of instances by name, making their loading order consistent

1 Like

Oh I never knew that I’ll use this to my advantage thanks for your help!

1 Like

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