Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a script that takes a person's clothes/hats and clones it inside a NPC?

Trying to make an NPC that disguises as a random person ingame by cloning their clothes and hats and putting it inside said NPC? Here is what I was thinking of:

m = game.Players:GetChildren()
Player = m[math.random(1,#m)]
	
  	  
	
	
Player.Pants:Clone().Parent = game.Workspace.NPC
Player.Shirts:Clone().Parent = game.Workspace.NPC

Any help will be appreciated.

3 comments

0

Also ignore Shirts as I meant to put Shirt.

0

Why don't you just clone them?

0

What do you mean by that? I did.

1 answer

Never mind, I answered my own question. Heres the script if anyone needs it.

game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) char:WaitForChild("Shirt" and "Pants") char.Archivable = true local d = char.Shirt local s = char.Pants

    d:Clone().Parent = game.Workspace.Flanker

    s:Clone().Parent = game.Workspace.Flanker

     

end)
end)

Replace Flanker with the name of the NPC.

Also local d and local s can be replaced. For example local s = char:Clone()

This discussion is preserved as it was. New answers, comments, and votes are closed.