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

Why is Clothing a nil value?

For some reason, whenever this script fires , Clothing comes back as nil. Everything is where it should be and spelled right..Thanks for any help.


local co = game.Lighting.OutfitStorage.Helmets

function WeldHelmet()

local PlayerAttire = player.PlayerGui:FindFirstChild("Outfit")
local Clothing = co:FindFirstChild(PlayerAttire.OutfitHelmet.Value)
	local char = player.Character or player.CharacterAdded:wait()
	local OutfitTop = Clothing:Clone()
	OutfitTop.Parent = game.Workspace

	for _,v in pairs(OutfitTop:GetChildren()) do
		if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
			v.Anchored = true
		end
	end
	
	OutfitTop.Parent = workspace
	
	for _,v in pairs(OutfitTop:GetChildren()) do
		if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
			if v ~= OutfitTop["HelmetCore"] then
				weld(v, OutfitTop["HelmetCore"])
			end
		end
	end
	
	local OutfitTopWeld = weld(OutfitTop["HelmetCore"], char["FakeHead"], CFrame.new())
	
	for _,v in pairs(OutfitTop:GetChildren()) do
		if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
			v.Anchored = false
			v.CanCollide = false
		end
	end
	
end

1 answer

If you are trying to find the Value property of the value that wont work. Use this instead:

local Clothing = PlayerAttire:FindFirstChild('OutfitHelmet').Value

1 comment

0

I'm not looking for something inside of PlayerAttire. I'm looking to match the value within PlayerAttire to a model in OutfitStorage.Helmets

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