Hello, sorry if I have chosen the wrong title but I don’t really know what to put there.
So what I try to do:
I try to copy a teleporter from Workspace and move it 20 studs (and that works). The teleporter teleports to a random minigame. The random minigames are in a folder in ReplicatedStorage called “games” In that folder are StringValue’s with the name of the minigames. In that StrinValue there is an NumberValue with the id of the minigame to teleport to. (there are currently 3 minigames)
If I run the script → it will clone the teleporter → move it 20 studs → gives the teleporter the game name and de game id to teleport. After that it will delete that game that has been chose so it can’ t be picked twice.
The problem:
If I run the script, sometimes it works perfect, but sometimes not. then it will pick a game, and copy it, and delete the game (StringValue). but for the next portal copy, it choses the exact same game (even if its deleted). and ofcourse, it gives then an error that it can’t see the game id because the game isn’t in the folder anymore
The question:
Is there a problem with the writing of the script or with how i deal with it?
The script:
local teleporter = game.Workspace.Teleporter
local games = game.ReplicatedStorage.games:GetChildren()
local distance = script.distance.Value
local counter = 1
wait(5)
while counter <= 3 do
distance = distance + 20
local clone = teleporter:Clone()
clone.Parent = game.Workspace
local randomgame = games[math.random(1, #games)]
local gamename = randomgame.Name
local gameID = randomgame.GameID.Value
clone.Teleporter.BillboardGui.TextLabel.Text = gamename
clone.Teleporter.gameID.Value = gameID
randomgame:Destroy()
clone.CFrame -= Vector3.new(distance)
clone.Teleporter.CFrame -= Vector3.new(distance)
counter = counter + 1
end
teleporter:Destroy()
Hopefully you understand what I try to say, and if you don’t, ask for more information and I will try to give you the information you need! 
If you get to this point, thanks for reading all of it and hopefully helping me,
Regards,
debestevanal
