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

Copy Particle Emitter to Certain Players Torso on Spawn?

Asked by 9 years ago

I have never scripted before but I found some cool particle emitters and I want it so say when a player with the name "Steve" joins they get one of the particle emitters copied into their characters torso, and then if the player "Bob" also joins, they get one of the other ones copied into their torso. So basically I want it so that specific players to have unique particles that are just for them on spawn.

I tried doing it myself but can't seem to figure it out. This is what I finally had when I rage quit.

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

    player.CharacterAdded:connect(function(character)

        if player.userId == "Player1ID" then

        script.Star.Clone = game.Workspace:findFirstChild("Player1").Torso

        elseif  player.userId == "Player2ID" then

        script.Fire.Clone = game.Workspace:findFirstChild("Player2").Torso

    end

    end)

end)

Obviously I replaced that "PlayerX" with the users actual information. I just really have no idea what I am doing.

2 answers

Log in to vote
2
Answered by 9 years ago

Your actually VERY VERY VERY VERY close to your solution. Here is the proper way to do this

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
 if player.Name == "Steve" or player.Name == "Bob" then
local star =  script.Star:Clone()
star.Parent = char.Torso
wait()
end
end)
end)

you can use the same thing for the fire thing also, edit as you please

Ad
Log in to vote
0
Answered by
dreamy67 135
9 years ago

By the looks of it, the particle effects are inside the script. If so, turn the particle's property "Enabled" to false, then use this script.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if player.userId == User1ID then -- Note that there are no quotations around the User1ID. You must do this for the ID as well.
            a = script.Star:Clone()
            a.Parent = character.Torso
            a.Enabled = true
        elseif player.userId == User2ID then -- Note that there are no quotations around the User1ID. You must do this for the ID as well.
            a = script.Fire:Clone()
            a.Parent = character.Torso
            a.Enabled = true
        end
    end)
end)

Answer this question