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.
What is the issue? The script should be fine, and I’m not getting any error messages. I don’t know my issue.
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)
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
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)
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)