Hey! so im making a challenge for scripting a game in 1 day and i kinda of need help quick, im a pretty advanced scripter
But my problem is: i want to make each number for a random generated code appear on a different note around the map, i already did the random note system and etc but im running into a problem, if i make the number appear on a random note inside a folder it can appear in any note if the note isnt used already
Can anyone help me make that?
My current script
local replicatedstorage = game:GetService("ReplicatedStorage")
local code = replicatedstorage.KeyCodePass
local newcode
newcode = math.random(100000,999999)
code.Value = newcode
local notes = workspace.Keycodes:GetChildren()
for i = 1, #tostring(newcode) do -- i already tried changing a lot of things
local note
repeat
note = notes[math.random(math.max(#notes, 1))]
if note.Name ~= "Used" then
note.SurfaceGui.TextLabel.Text = i
note.Name = "Used"
end
until note.Name == "Used"
end