Why does my code also clone Tools into workspace with the players name

local module = {}

local ServerStorage = game:GetService("ServerStorage")
local CharactersFolder = ServerStorage.Characters

module.FindMorph = function (Plr,MorphName)
	for i,v in pairs(CharactersFolder:GetDescendants()) do
		if v.Name == MorphName then
			for _,MorphItems in pairs(v:GetChildren()) do
				if MorphItems:IsA("Model") then
					Plr.MorphName.Value = MorphItems.Parent.Name
					module.MorphPlayer(Plr,MorphItems)
				end
			end

			for _,Tools in pairs(v:GetChildren()) do
				if Tools:IsA("Tool") then
					local Clone =  Tools:Clone()
					Clone.Parent = Plr.Backpack
				end
			end

			return
		end
	end
end

module.MorphPlayer = function (Plr,Morph)
	repeat task.wait() until Plr.Character
	local plrRoot = Plr.Character:FindFirstChild("HumanoidRootPart") or Plr.Character:FindFirstChild("Torso")
	local Animate = game.ReplicatedStorage:FindFirstChild("Animate"):Clone()
	local foot = game.ReplicatedStorage:FindFirstChild("ACS_Client"):Clone()


	local charClone = Morph:Clone()
	charClone.Name = Plr.Name
	Animate.Parent = charClone
	foot.Parent = charClone
	Plr.Character = charClone
	charClone.Animate.Disabled = false

	local rootPart = charClone:FindFirstChild("HumanoidRootPart") or charClone:FindFirstChild("Torso")

	if rootPart and plrRoot then
		rootPart.CFrame = plrRoot.CFrame
	end
	
	Plr.GotCharacter.Value = true
	
	charClone.Parent = workspace
end

return module```

image_2023-03-18_080049339

Tools inherit Model now, which means your MorphItems:IsA("Model") check will also match tools. You might want to switch it to MorphItems.ClassName == "Model" or another similar change.

OOOOH, I see, thank you! :heart_decoration: 30char

image
It didnt work after I set it to MorphItems.ClassName == “Model”

After even using ClassName ~= “Tool”, it did not work. I still need help with this :frowning_face:

Update, It still does not work. I tried to use ClassName, I tried to use FindFirstChild(“StarterCharacter”), nothing worked. Still need help

Where is the tool located? In StarterPlayer?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.