My model only clone once

So, I need that when a player buys a PC, it goes to his plot, however the pc is not being cloned (it is on ServerStorage) but just changing its position as you can see in the video.

Buy code:

--// Plots:
local A = workspace.Plots.Plot1.PlotA
local B = workspace.Plots.Plot2.PlotB
local C = workspace.Plots.Plot3.PlotC
local D = workspace.Plots.Plot4.PlotD
local E = workspace.Plots.Plot5.PlotE
local F = workspace.Plots.Plot6.PlotF

--// Owners:
local OwnerA = A.Owner
local OwnerB = B.Owner
local OwnerC = C.Owner
local OwnerD = D.Owner
local OwnerE = E.Owner
local OwnerF = F.Owner

--// Variáveis:
local click = script.Parent
local price = 200
local ss = game:GetService("ServerStorage")
local PC = ss.PCs.PC2
local db = false

click.MouseClick:Connect(function(player)

	if db == false then
		db = true
		
		local cash = player.leaderstats.Money
		local plot = player.Plot.Value

		if 	cash.Value >= price then
			cash.Value = cash.Value - price

			if 	player.Plot.Value == "PlotA" then
				PC:Clone()
				PC.Parent = A.Parent
				PC:SetPrimaryPartCFrame(CFrame.new(A.Position))

			elseif
				player.Plot.Value == "PlotB" then
				PC:Clone()
				PC.Parent = B.Parent
				PC:SetPrimaryPartCFrame(CFrame.new(B.Position))
			elseif
				player.Plot.Value == "PlotC" then
			elseif
				player.Plot.Value == "PlotD" then
			elseif
				player.Plot.Value == "PlotE" then
			elseif
				player.Plot.Value == "PlotF" then
			end					
		end
		wait(1)
		db =false
	end
end)

PC location:

image

and yes, I know the script is really bad, but that’s because I started programming last month.

:Clone() should return a clone of the object but without changing the variable, change this

to this

local Clon = PC:Clone()
Clon.Parent = A.Parent
Clon:SetPrimaryPartCFrame(CFrame.new(A.Position))

and that

to this

local Clon = PC:Clone()
Clon.Parent = B.Parent
Clon:SetPrimaryPartCFrame(CFrame.new(B.Position))
1 Like

It worked! Thank you so much for the explaining.

1 Like