Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Is Clone Method Not Working Here?

Asked by 10 years ago
local Officer = game.ReplicatedStorage.Characters.Officer

local Cloned = false

local Cops = {Officer}

CopsSelected = {}

local SelcCop = nil

function CopSelect()
    for i, v in pairs(Cops) do
        if game.Players.NumPlayers >= 2 and game.Players.NumPlayers <= 12 then
            SelcCop = game.Players:GetChildren()[math.random(1, game.Players.NumPlayers)]
            print("Chosen Cops are "..SelcCop.Name..".")
                    for _,l in pairs(SelcCop.Character:GetChildren()) do
                        if l:IsA("CharacterAppearance") or l:IsA("Hat") then
                            l:Destroy()
                            print("Stuff destroyed")
                        end
                end
        end
                for _,Aper in pairs(Officer:GetChildren()) do
                    if Aper:IsA("CharacterMesh") or Aper:IsA("Hat") then
                        if not Cloned then
                        cloneoff =  Officer:Clone()
                            end
                                if SelcCop ~= nil then
                                    cloneoff.Parent = SelcCop.Character
                                    Cloned = true
                                    wait(2)
                                    Cloned = false
                                end
                        end
                end
        end
end

CopSelect()

It doesn't clone to the chosen player, it just clones.

0
*Please* retab your code and remove all of those extra lines BlueTaslem 18071 — 10y
0
Done. TREVOR818730 25 — 10y

Answer this question