How to get same number on every client

I am trying to choose a random number and also having it the same for every player. I tried using Random.new(0) but it sometimes isn’t the same.

I am controlling the random numbers on the client.

local random = Random.new(0)

for i = 1, 100, 1 do
	local part = Instance.new("Part")
	part.Position = Vector3.new(random:NextInteger(-100, 100), random:NextInteger(-100, 100), random:NextInteger(-100, 100))
	part.Parent = workspace
end

The best way would probably to use a remotevent, have the server come up with the random number, then have it set a value or attribute somewhere, where the client can access and therefore use it. You could also send a remotefunction if you wish to return it that way to each client, but it’d take up more event requests.

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