So I'm trying to make a random blocks generator on a certain area, here's my code, when I test how many children the generator node has after it was meant to duplicate the node it says 1, and only 1 block was randomized on the game when I play it, by my testing there is some problem with the duplicate() function, it just doesnt duplicate the block
func RandomTilePosition():
var x = randrange(-7, 6) #Generates a X position
randomize()
var z = randrange(-7, 6) #Generates a Z position
randomize()
var returning = Vector3(round(x) + 0.5, 1.5, round(z) + 0.5) #sets a variable to what I need to return, to test it later
if not returning == Vector3(-6.5, 1.5, 6.5): #tests if its not the exact place the player will spawn
return Vector3(round(x) + 0.5, 1.5, round(z) + 0.5) #gives the randomized value when you use the function
var Walls = []
func ready():
if Global.difficulty == 1: #this is for a thing on my game, ignore
for count in range(3): #duplicates the block 3 times
Walls.insert(Walls.size(), RandomTilePosition()) #saves the random number on a list to use it later
getnode("Wall").translation = Walls[count] #sets the position of the block to then duplicate it on the right area
print(Walls[count])
getnode("Wall").duplicate() #this is the part that I think is not working, and by what I saw its the only way to duplicate
print(getchild_count())


