Terrain generation issue

Hi there, I’ve been having trouble lately trying to figure out why terrain generation is not working in my code. short story short, I’ve made some parts to test as terrain generation with non-collidable (is that even a word?) steps acting as the trigger for terrain generation via player contact. However, for whatever reason, the entire source of code runs fine except when it hits this section right here:
image
That is where I suspect the problem is despite there being no errors in the output since all clues lead to it, but regardless it seems like for whatever reason it never executes properly after that (models in replicatedstorage do not clone at all). I’m confused for this type of situation and all I can guess is this is telling me that I can convert math.random values to string ones but can’t compare one to the other after conversion (if math.random values are strings by default don’t quote me on it, I’m still learning lua quite a bit sorry) for whatever reason. Everything else has been made sure to be correct as well including the names of the models and the correct assigning of primary parts so said models but it refuses to replicate to workspace anyway. If I’m being too vague here, here’s the full code for you to understand it better:

script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
	local radnumb = math.random(1,2)
	if radnumb == 1 then
		radnumb = "Grasslands"
	local repstore = game:GetService("ReplicatedStorage")
	local part = repstore:GetChildren()
		if part.Name == radnumb then
			part:Clone()
		local primaryp = script.Parent.Parent.PrimaryPart
		part.Parent = game.Workspace
		part:SetPrimaryPartCFrame(primaryp.CFrame)
		part:MoveTo(primaryp.Position + Vector3.new(0, 0, 30))
		print("Script will now be destroyed.")
		script:Destroy()
	else
			warn(radnumb.." did not load. Replication Failure!")
			end
	elseif radnumb == 2 then
		radnumb = "Snow Biome"
	local repstore = game:GetService("ReplicatedStorage")
	local part = repstore:GetChildren()
		if part.Name == radnumb then
			part:Clone()
		local primaryp = script.Parent.Parent.PrimaryPart
		part.Parent = game.Workspace
		part:SetPrimaryPartCFrame(primaryp.CFrame)
		part:MoveTo(primaryp.Position + Vector3.new(0, 0, 30))
		print("Script will now be destroyed.")
		script:Destroy()
	else
		warn(radnumb.." did not load. Replication Failure!")
	end
	
	end
end
end)

heres the stored items that are supposed to be cloned into workspace (layout of models is identical to the one that’s trying to clone these for generation):
image

Am I missing events or something? I’m still a amatuer at lua so any help solving this issue would be appreciated! Thank you.

If you want to learn about terrain generation try researching Perlin noise or according to Roblox, math.noise

The widget in Studio that generates terrain, made by StickmasterLuke, is open source. You can take a look at the code, make it suitable to run in a non-plugin environment, and then you can tweak the code as much as you like. This game that I made a long time ago did this, and it was pretty easy to get it to work. I have uncopylocked it, so if you want the source, feel free to copy it and play around with it.