How could I make a effect float around a specific player?

How would I create a script that would make a effect such as fire float a specific player for an example how would I make fire float around me?

I already have a player detecting script I don’t know if it is correct.

local players = {"JoshBloxRblx", "", "slenderW0lf_YT"}

local fire = game.ServerStorage.Fire

game.Players.PlayerAdded:connect(function(plr)

 plr.CharacterAdded:connect(function(chr)

  for i = 1, #players do

   if players[i] == plr.Name then
2 Likes

Some of the code in your post is missing.

1 Like

which part is missing? Because I don’t know what to put after

if players[i] == player.Name then

Oh, I see. I thought you forgot something.

You can just place a particle emitter in a body part. You could continue the code with something like this:

local pe = Instance.new("ParticleEmitter")
--I would modify the particle emitter before setting the parent
pe.Parent = chr.Head

If you have R6 and R15 characters in your game, be sure to check what kind of character it is. Otherwise, the script may look for a “Left Leg”, but the character actually has something like “Left Upper Leg” (names are not exact). If it’s just the Head though, then it’s fine.

Also, the for loop is not needed. You can just do something like this:

game.Players.PlayerAdded:connect(function(plr)
  if plr.Name == "JoshBloxRblx" or pl.Name == ... --if you have a longer list of people, there is a better way to do this
    plr.CharacterAdded:connect(function(chr)
      local pe = Instance.new("ParticleEmitter")
      pe.Parent = chr.Head
    end)
  end
end)

That is awesome but would I put the ParticleEmitter into server storage or would it be the parent?

if u want the clone the particleemitter u could put it in server storage then clone it into the desired part when u want.

Would I put it between this?

local pe = instance.new("ParticalEmitter")
pe.Parent = chr.Head
  if plr.Name == "JoshBloxRblx" or pl.Name == ... --if you have a longer list of people, there is a better way to do this
    plr.CharacterAdded:connect(function(chr)
      local pe = Instance.new("ParticleEmitter")
      pe.Parent = chr.Head
    end)
  end
end)

Ok, well first off do u want to create a new instance of a particle emitter or do u want to design one of ur choice then clone it into the player’s character.

I have a partical emitter already so how would I create a new instance?

Instead of doing

local pe = Instance.new("ParticleEmitter")

you would do

local pe = game.ServerStorage.myparticleemitter:Clone() --replace myparticleemitter with whatever your named it

I have this in my script

  if plr.Name == "slenderW0lf_YT" or pl.Name ==  --if you have a longer list of people, there is a better way to do this
    plr.CharacterAdded:connect(function(chr)
	local pe = game.ServerStorage.Fire:Clone()
      pe.Parent = chr.Head
    end)
  end
end)

but when I test it out it doesn’t work. There is also a red line under the end without a ). There is a script error that says “Expected ‘then’ when parsing if statement, got ‘end’”

I meant for you to replace the “…” with more code, as I assumed you had more people’s names.

You can do this:

if plr.Name == "slenderW0lf_YT" then --note the difference here
    plr.CharacterAdded:connect(function(chr)
	local pe = game.ServerStorage.Fire:Clone()
      pe.Parent = chr.Head
    end)
  end
end)

Yes, I do have more players names but I believe there is one last error with the last end). And the error says

“Expected , got ‘end’”

game.Players.PlayerAdded:connect(function(plr)
  if plr.Name == "imalex4" then
    plr.CharacterAdded:connect(function(chr)
      local pe = Instance.new("ParticleEmitter")
      pe.Parent = chr.Head
    end)
  end
end)

Be sure to keep studying your Roblox Lua programming. I don’t recommend only learning from specialized tutorials.

2 Likes

Alright thank you, I will do that!

1 Like