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
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)
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.
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)
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.