Tycoon buying Button not working

Hi! In my tycoon game I’m trying to make buttons to buy droppers and stuff but its not working.
Idk what the problem is exactly but when I join the game the dropper is just deleted out of existence
and when I touch the button it disappears and nothing happens.

I haven’t found a solution to the problem online and it’s really complicated stuff and all the tutorials I watched just tell me to copy them without explaining anything so I don’t understand most of it.
I thought maybe its just a problem with the dropper not the button so I tried changing the item value on the button to some part and same problem.

Here is a video of what happens:
robloxapp-20210903-2309360.wmv (966.3 KB)

Please help, this is my code:

for i, v in pairs(buttons:GetChildren()) do
local NewItem = purchaced:FindFirstChild(v.Item.Value)
if NewItem ~= nil then
items[NewItem.Name] = NewItem:Clone()

	NewItem.Parent = game.ServerStorage
	
else
	v.ButtonPart.Transparency = 1
	v.buttonPart.CanCollide = false
end

if v:FindFirstChild("Dependency") then
	coroutine.resume(coroutine.create(function()
		v.ButtonPart.Transparency = 1
		v.ButtonPart.CanCollide = false
		
		if purchaced:WaitForChild(v.Dependency.Value, 100000) then
			v.ButtonPart.Transparency = 0
			v.ButtonPart.CanCollide = true
		end
	end))
end

v.ButtonPart.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then
		local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
		if values.OwnerValue.Value == Player then
			
			if v.ButtonPart.CanCollide == true and v.ButtonPart.Transparency == 0 then
				NewItem.Parent = purchaced
				if Player:WaitForChild("leaderstats").Cash.Value >= v.Price.Value then
					Player.leaderstats.Cash.Value -= v.Price.Value
					items[v.Item.Value].Parent = purchaced
					v:Destroy()
				end
			end
		end
	end
end)

end

Someone please help me solve the problem.

In the very beginning you are creating a loop to clone an object into the ServerStorage where models cannot be viewed by the client, Is this intentional? You will generate a fairly large collection of droppers in the server, although im not sure what the NewItem variable is referencing in buttons children.

I would also suggest formatting your code in the Devoforum properly and also embedding the video, a lot of the time not doing that will turn people away from looking into the issue.

Sorry for the really lat reply. I’m not really sure if its intentional or not. I got the code from a tutorial by someone named GamerM8. I’m still a beginner so I don’t understand the code much, but the code is in a main script for the tycoon and I think is supposed to make it so that when you click the button it subtracts from your money and spawns in the object the string value “Item” is set to. so that instead of making code for each indivisual button you could spawn in the item change its Item value to what you want and then subtract from its set price value.

also btw thanks for the tips about formating.