I am trying to make two Textlabels Have the Same Number and Make them have a random number.
while true do
for i=1,100 do
script.Parent.Part2.SurfaceGui.TextLabel1.Text = math.random(1,9)
script.Parent.Part1.SurfaceGui.TextLabel1.Text = math.random(1,9)
script.Parent.Part2.SurfaceGui.TextLabel2.Text = math.random(01,99)
script.Parent.Part1.SurfaceGui.TextLabel2.Text = math.random(01,99)
wait(1800)
end
end
How Do I make it Sync Random Numbers If Could Point out What Is stopping It That would be great
math.random() might be yielding your script, causing this synchronization issue. Try storing it in a variable and you should expect the desired result:
while true do
for i=1,100 do
local num1 = math.random(1, 9)
script.Parent.Part2.SurfaceGui.TextLabel1.Text = num1
script.Parent.Part1.SurfaceGui.TextLabel1.Text = num1
local num2 = math.random(1, 99)
script.Parent.Part2.SurfaceGui.TextLabel2.Text = num2
script.Parent.Part1.SurfaceGui.TextLabel2.Text = num2 -- Initialise another variable if you need a different value for this.
task.wait(1800) -- Also use task.wait
end
end
math.random is not a yielding function. It is a function that returns a number between X-to-Y.
If the issue is that it’s taking too long to get to the next random number, the OP should lower the wait time. 1800 seconds equates to 30 minutes, half an hour.