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

Morph Script Help?

well im making a Morph code, that when the player joins the game they look like a certain character, and the torso is supposed to be a random color. What's wrong with it?


game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Player:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
 playerinplayers.CanLoadCharacterAppearance = false
 plr.Head.face.Texture = "rbxassetid://24791658"
 local bodycolors = Instance.new("BodyColors", plr)
 bodycolors.RightArmColor = BrickColor.new("Pastel brown")
 bodycolors.LeftArmColor = BrickColor.new("Pastel brown")
 bodycolors.LeftLegColor = BrickColor.new("Dark stone grey")
 bodycolors.RightLegColor = BrickColor.new("Dark stone grey")
 bodycolors.TorseColor = BrickColor.Random()
 bodycolors.HeadColor = BrickColor.new("Pastel Brown")


end

1 comment

0

Why don't you change the Arms, Legs, ect. inside the Character, isn't of having the 'BodyColors' instance do it(, I don't use it, so I don't know it's purpose)? Also, you spelled 'Players' wrong on line 3. :)

1 answer

✓ Accepted answer
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name 
local playerinplayers = game.Players:FindFirstChild(plr.Name)
local asset = "rbxassetid://" -- asset link
if playerinplayers ~= nil then
	playerinplayers.CanLoadCharacterAppearance = false
	plr.Head.face.Texture = "rbxasset://63761658" -- changes face
	local bodycolors = Instance.new("BodyColors", plr)
	bodycolors.RightArmColor = BrickColor.new("Pastel Brown") -- changes player color
	bodycolors.LeftArmColor = BrickColor.new("Pastel Brown")
	bodycolors.LeftLegColor = BrickColor.new("Dark stone grey")
	bodycolors.RightLegColor = BrickColor.new("Dark stone grey")
	bodycolors.HeadColor = BrickColor.new("Pastel Brown")
	bodycolors.TorsoColor = BrickColor.new(math.random())
local shirt = Instance.new("Shirt", plr)
shirt.ShirtTemplate = asset.."0" set to shirt template id
local pants = Instance.new("Pants", plr)
pants.PantsTemplate = asset.."0" -- set to pants template id
end
end)

Here ya go it should be (math.random()) not .Random()

1 comment

0

thx

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