Why wont particle insance happen?

  1. What do you want to achieve?
    I’m trying to make it so that whenever a player joins the game, they have a particle emitter parented to their head.

  2. What is the issue?
    The script should be fine, and I’m not getting any error messages. I don’t know my issue.

  3. What solutions have you tried so far?
    There where no solutions in the forum, but I think you guys can help.

--Here is the script

game.Players.PlayerAdded:Connect(function(plr)
local character = plr.Character
local part = instance.New("ParticleEmitter")
part.Parent = character.Head
end)
1 Like

Try:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local pe = Instance.new("ParticleEmitter", char:WaitForChild("Head"))
	end)
end)

One of the problems was that you were trying to add it before the character was loaded. Another problem is that you were doing
instance.New, not Instance.new, so in the future please use Instance.new

1 Like

It is probably because you wrote Instance.new() In the wrong way. The right way to write is Instance.new(). And also because you have to add the Particle once the Character is added. I have tried doing a new version for you, Let me know if it works!

-- Variables
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

-- Main
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		-- Waits until the next Heartbeat Signal.
		RunService.Heartbeat:Wait()

		-- Creates the Particle.
		local ParticleEmitter = Instance.new("ParticleEmitter")
		ParticleEmitter.Parent = Character:FindFirstChild("Head") or Character:WaitForChild("Head")
	end)
end)
1 Like

Yeah, I didn’t copy/paste the code. I know the instance new capitalization thing. I wrote it the right way in the script

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		local head = character:WaitForChild("Head")
		local particles = Instance.new("ParticleEmitter")
		particles.Parent = head
	end)
end)

This is working for me.

2 Likes

Thanks! I didn’t think to use the character loaded event!

FYI, don’t use the 2nd parameter of Instance.new()

you mean like, to add the parent? I agree. I normally add the parent as a separate line.

What your trying to say is I shouldn’t do it like:

Instance.new("part", game.Workspace)

Rather I should do it like:

local part = Instance.new("Part")
part.Parent = game.Workspace
1 Like

yes, this is what I mean by that

1 Like