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

How can I change a person to another character?

In Darkness II When your beast you change into a another character How can I do that I need that for the GCC Contests

2 answers

✓ Accepted answer

If this helps. :)

--[[
	Put this script in StarterGui.
	Script by JustGimmeDaBux
	Feel free to remove ^^!
	Enjoy!
--]]

--These two, while being capable of being IDs can also function as randomized arrays of clothing
--Y'know, in case you wanna spice things up. >:3

--Take the AssetID(the random numbers at the end of the URL when looking at a shirt/pants
--and subtract it by 1 to get the IDs
local shirtIDs = {"ID","ID","MOREIDS","MOREIDS"}
local pantsIDs = {"ID","ID","MOREIDS","MOREIDS"}

--[[
	It sounds a bit mean, but the CFraming of hats is a very hat-specific process,
	and I really couldn't work in a way of making Hats modular. I'll continue to work on this one!
	Also working on body colors!
--]]


--[[
	This first function basically just cleans out the stuff the character is already
	wearing. I don't suggest messing with it as the code here is a bit... messy. :S
--]]
function CleanUpJunk(char)
	local stuff=char:GetChildren()
	for _,junk in pairs(stuff) do
		if junk.Name~="Health" and junk.Name~="Sound" and junk.Name~="Humanoid" and junk.Name~="Animate" and junk.Name~="Head" and junk.Name~="HumanoidRootPart" and junk.Name~="Left Arm" and junk.Name~="Right Arm" and junk.Name~="Left Leg" and junk.Name~="Right Leg" and junk.Name~="Torso" then
			junk:Destroy()
		end
		if junk.Name=="Torso" then
			junk.roblox:Destroy()
		end
	end
end
--[[
	Alright, the ugly mess should be out of the way now. Now we get to do the FUN stuff! :DDDD
--]]
function CreateOutfit(char)
	
	--Make le shirt
	local randomShirt=math.random(1,#shirtIDs)
	local shirt=Instance.new("Shirt")
	shirt.Parent=char
	shirt.Name="Shirt"
	shirt.ShirtTemplate=("http://www.roblox.com/asset/?id=" .. shirtIDs[randomShirt])
	
	--Make le pants
	local randomPants=math.random(1,#pantsIDs)
	local pants=Instance.new("Pants")
	pants.Parent=char
	pants.Name="Pants"
	pants.PantsTemplate=("http://www.roblox.com/asset/?id=" .. pantsIDs[randomPants])
	
	local colors=script:FindFirstChild("Body Colors")
	colors:Clone().Parent=char
end

wait(3)
local char=game.Players.LocalPlayer.Character
CleanUpJunk(char)
CreateOutfit(char)

Have fun!

There are two ways you can edit a character. The first is to simply edit the things in the character, changing or removing the Shirt and Pants, changing BodyColors, adding or removing hats.

The second way is more difficult. You use the character property of Player to give them a completely new character.

game.Players.Player.Character = game.Workspace.Model

This is more difficult because the model that you set the character to must have everything in it needed to support a player's control. Mainly, a humanoid, but it should also have other scripts normally inserted into characters.

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