so im making a thing where when u touch someone your body parts become yellow. However, the character is the a member of backpack is what the output says and i have no idea what to do. Help.

Here is the script:

wait()
if script.Parent then
	if not script.Parent:IsA("Script") or not script.Parent.Name == "StarterGear" then
		local debris = game:GetService("Debris")
		local backpack = script.Parent
		local player = backpack.Parent
		while player.Character == nil do wait() end
		local character = player.Character
		if character then
			while character:FindFirstChild("Humanoid") == nil do wait() end
			local hum = character:FindFirstChild("Humanoid")

		-- Logia
		local charparts = character:GetChildren()
		for i = 1, #charparts do
			local charpart = charparts[i]
			if charpart:IsA("BasePart") and charpart.Name ~= "Head" then
				charpart.Touched:connect(function(hit)
					if charpart:FindFirstChild("Hide") then return end
					local stop = true
					if hit ~= nil then
						if hit.Parent ~= nil then
							if hit:FindFirstChild("creator") or 		hit.Parent:FindFirstChild("creator") then
								stop = false
							elseif hit.Parent:FindFirstChild("Humanoid") then
								if hit.Parent:FindFirstChild("Humanoid") ~= hum 		then
									stop = false
								end
							end
						end
					end
					if stop then return end
					local hidemesh = Instance.new("SpecialMesh")
					hidemesh.Name = "Hide"
					hidemesh.MeshType = "FileMesh"
					hidemesh.MeshId = ""
					hidemesh.Scale = Vector3.new(0, 0, 0)
					hidemesh.Parent = charpart
					debris:AddItem(hidemesh, 1.5)
					
					local bodyeffect = Instance.new("Part")
					bodyeffect.Name = "BodyEffect"
					bodyeffect.Transparency = 0.4
					bodyeffect.CanCollide = false
					bodyeffect.FormFactor = "Custom"
					bodyeffect.TopSurface = "Smooth"
					bodyeffect.BottomSurface = "Smooth"
					bodyeffect.CFrame = charpart.CFrame
					bodyeffect.BrickColor = BrickColor.new("New Yeller")
					bodyeffect.Size = charpart.Size
					
					local bodeffect = Instance.new("Part")
					bodeffect.Name = "BodyEffect"
					bodeffect.Transparency = 0.4
					bodeffect.CanCollide = false
					bodeffect.FormFactor = "Custom"
					bodeffect.TopSurface = "Smooth"
					bodeffect.BottomSurface = "Smooth"
					bodeffect.CFrame = charpart.CFrame
					bodeffect.BrickColor = BrickColor.new("New Yeller")
					bodeffect.Size = Vector3.new(0.5, 0.5, 0.5)
					
					local msh = Instance.new("SpecialMesh")
					msh.MeshType = "Sphere"
					msh.Scale = Vector3.new(1, 1, 1)
					msh.Parent = bodeffect

					local light = Instance.new("PointLight")
					light.Brightness = 5
					light.Range = 10
					light.Color = Color3.new(251, 255, 0)
					light.Parent = bodyeffect

					bodyeffect.Parent = charpart.Parent



					local weld = Instance.new("ManualWeld")
					weld.Part0 = bodyeffect
					weld.Part1 = charpart
					weld.C1 = charpart.CFrame:inverse() * bodyeffect.CFrame
					weld.Parent = bodyeffect

					debris:AddItem(bodyeffect, 1.5)

					end)
				end
			end
		end
	end
end

4 comments

0

If you have a really long script, you should cut out the unnecessary bits and only leave in the parts of the code that you think are responsible for the errors. No one is looking through all this code.

0

omg, @LordDragonZord, I agree

0

This is 99.9% a free model, the whole creator thing is outdated and the numeric for loops on arrays are typically a sign of a free model.

0

@incapaz well, creator is useful when recording stats on who kills who. The website keeps track of how many kills you get via the creator tag. I don't know if they still do the combat badges, if they've stopped then creator tagging is indeed useless.