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

Why doesn't my morph script work?

I wrote this script to make so that when the player(s) enter the game it clones the morph in the character, but I tried and didn't work. I'm a beginner scripter and I would appreciate if you guys can help.

local Player = game.Players.LocalPlayer.Character
local morph = game.ReplicatedStorage.Morphs.[Robloxian 2.0]
function playerentered()
if morph then 
morph:GetChildren()
morph:clone()
morph.Parent = Player 
script.Parent:connect(playerentered)

1 answer

--Insert this into your spawnpoints, so the players will spawn with it happening 
function onTouch(hit)
		local Morph = game.ReplicatedStorage.Morphs:findFirstChild("Robloxian 2.0")
		BodyParts = hit.Parent:GetChildren()
		for i,b in pairs(BodyParts) do
			if (b.className == "Humanoid") then
			end
			wait(0.1)
		end

		BodyParts = hit.Parent:GetChildren()
		for i,b in pairs(BodyParts) do
			if (b.className == "CharacterMesh") or (b.className == "Hat") or (b.className == "Shirt") or (b.className == "Pants") or (b.className == "ShirtGraphic") then
				b:Remove()
			end
			if (b.className == "Part") then
			if (b.Name == "Head") then
					if (b:findFirstChild("Mesh") ~= nil) then
						b.Mesh:Remove()
					end
				end
			end
			wait(0.1)
		end

		BodyParts = Morph:GetChildren()
		for i,b in pairs(BodyParts) do
			if (b.className == "CharacterMesh") or (b.className == "Shirt") or (b.className == "Pants") or (b.className == "ShirtGraphic") then
				b:Clone().Parent = hit.Parent
			end
		if (b.className == "Part") then
			if (b.Name == "Head") then
			if (b:findFirstChild("Mesh") ~= nil) then
						b.Mesh:Clone().Parent = hit.Parent.Head
					end
				end
			end
		wait(0.1)
		end
	end
script.Parent.Touched:connect(onTouch)

Edit this to your needs, and If you have any questions, PM me or reply to this answer.

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