Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Clone A Particle Emitter Into A Player's Torso?

Asked by 3 years ago

Hi, I'm trying to make it that if a player reaches a certain amount of rebirths and levels, they gain this particle emitter(Like an aura) cloned into their torso.

Here is my script:

game.Players.PlayerAdded:Connect(function(player)
    if player.leaderstats.Levels.Value >= 50 and player.leaderstats.Rebirths.Value >= 5 then
        game.ServerStorage.Auras.Lightning:Clone().Parent = player.Torso
print("Torso Given")

    end
end)

The script is a ServerScript inside of StarterCharacterScripts. The ParticleEmitter is in ServerStorage.

Is something wrong in the method I'm using to clone it? Or am I incorrectly accessing the torso? Also, the print doesn't show up.

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You seem to have mixed up the player and his character. The player object does not have a torso, however his character does; but in order to access the character you'll have to wait for the .CharacterAdded event to fire.

Like below:

players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        particleEmitter:Clone().Parent = character:FindFirstChild("Torso")
    end)
end)
0
Ok thanks, let me try it. Itz_Visually 17 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Ok, here is my script now

game.Players.PlayerAdded:Connect(function(player)
    local Aura = game.ServerStorage.Auras.Lightning
    player.CharacterAdded:Connect(function(Char)
        if player.leaderstats.Levels.Value >= 50 and player.leaderstats.Rebirths.Value >= 5 then
            Aura:Clone().Parent = Char:FindFistChild("Torso")
        end
    end)
end)

I still don't see anything print or any errors occur.

:

0
FindFirstChild not FindFistChild. radiant_Light203 1166 — 3y
0
Oops Itz_Visually 17 — 3y
0
I still don't see anything. Itz_Visually 17 — 3y

Answer this question