I have some code that should be making it so that each player that joins gets a different "IP" but every player gets the same one...
My code:
math.randomseed(tick() % 1 * 1e7) --I took some of your code and tried to make it work with mine
local t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30 --defining variables
t = 0
_G.UIP = {t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30} --asigning variables
local StaticLocalIP
function randomIP()
return math.random(0, 255)
.. "." .. math.random(0, 255)
.. "." .. math.random(0, 255)
.. "." .. math.random(0, 255)
end
function ipTaken(ip)
for _, value in ipairs(_G.UIP) do
if value == ip then
return true
end
end
end
function uniqueIP() --makes unique IP
local StaticLocalIP
repeat
StaticLocalIP = randomIP()
until not ipTaken(StaticLocalIP)
table.insert(_G.UIP, StaticLocalIP)
return StaticLocalIP
end
StaticLocalIP = uniqueIP() -- assigns variable for rest of script
game.Players.PlayerAdded:connect(function(player)
print(player.Name.. " Has joined and is asigned the following IP: ".. StaticLocalIP)--prints some info
t = t + 1
--I know there is a better way to do this:
if t==1 then
t1 = StaticLocalIP
elseif t==2 then
t2 = StaticLocalIP
elseif t==3 then
t3 = StaticLocalIP
elseif t==4 then
t4 = StaticLocalIP
elseif t==5 then
t5 = StaticLocalIP
elseif t==6 then
t6 = StaticLocalIP
elseif t==7 then
t7 = StaticLocalIP
elseif t==8 then
t8 = StaticLocalIP
elseif t==9 then
t9 = StaticLocalIP
elseif t==10 then
t10 = StaticLocalIP
elseif t==11 then
t11 = StaticLocalIP
elseif t==12 then
t12 = StaticLocalIP
elseif t==13 then
t13 = StaticLocalIP
elseif t==14 then
t14 = StaticLocalIP
elseif t==15 then
t15 = StaticLocalIP
elseif t==16 then
t16 = StaticLocalIP
elseif t==17 then
t17 = StaticLocalIP
elseif t==18 then
t18 = StaticLocalIP
elseif t==19 then
t19 = StaticLocalIP
elseif t==20 then
t20 = StaticLocalIP
elseif t==21 then
t21 = StaticLocalIP
elseif t==22 then
t22 = StaticLocalIP
elseif t==23 then
t23 = StaticLocalIP
elseif t==24 then
t24 = StaticLocalIP
elseif t==25 then
t25 = StaticLocalIP
elseif t==26 then
t26 = StaticLocalIP
elseif t==27 then
t27 = StaticLocalIP
elseif t==28 then
t28 = StaticLocalIP
elseif t==29 then
t29 = StaticLocalIP
elseif t==30 then
t30 = StaticLocalIP
end
_G.UIP = {t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30} --reasignes table
for index, value in ipairs(_G.UIP) do --prints whole table
print(index, '=', value)
end
end)
game.Players.PlayerRemoving:connect(function(player) --when the player leaves resets a bit
t = t - 1
end)
does anyone know why this is giving everyone the same "IP"
I still have a lot of work to don't worry I know like with the player removing function

2 comments
I have Changed it BlueTaslem
And it still prints the same thing for every person