Attempt to index nil with Enabled

Hi there,

I ran into this issue

Here’s my code.

	elseif Arg == "ProductPurchased" then
		script.Parent.MainShop.PurchaseRobux.Visible = false
		script.Parent.MainShop.PurchaseBackpack.Visible = false
		script.Parent.MainShop.Backpacks.Open.Visible = true
		script.Parent.MainShop.Robux.Open.Visible = true
		script.Parent.MainShop.Visible = false
		Argument:FireServer("ResetHumanoidInstances")
		script.Parent.BucksSound:Play()
		script.Parent.ExtraSound:Play()
		Player.Character.Head:FindFirstChild("WhiteParticle").Enabled = true --Error line
		Player.Character.Head:FindFirstChild("MoneyParticle").Enabled = true
		wait(2)
		Player.Character.Head:FindFirstChild("WhiteParticle").Enabled = false
		Player.Character.Head:FindFirstChild("MoneyParticle").Enabled = false
	end

Weird thing is, I am adding the particles as soon as the player joins, but they just don’t add?

	Player.CharacterAdded:Connect(function(Character)
		--SetGuiValues
		
		repeat wait() until Candy and Money 
		
		--Put particle emitter in HumanoidRootPart
		local s, e = pcall(function()
			local particle = ReplicatedStorage:FindFirstChild("WhiteParticle")
			local particle2 = ReplicatedStorage:FindFirstChild("MoneyParticle")
			particle:Clone().Parent = Character.Head
			particle2:Clone().Parent = Character.Head
		end)
		
		if not s then
			warn(e)
		end

	end)

Any fix? I really don’t know how to fix it

Use WaitForChild instead of FindFirstChild in the first script? Or is there a reason you’re using that

Any chance it gets stuck on the repeat wait() until Candy and Money line?

I’ve been teached to not use any :WaitForChild() or :FindFirstChild() if you’re 100% sure it’s already there

Wait. GOod point. It seems like it does get stuck there.

You can check by putting a print right after it and seeing if it prints.

It seems to appear that the Humanoid.Died check broke, and that the script only works whenever you die? Huh?

My script only works whenever you have died atleast 1 time before. This is so weird.