I have tried multiple ways to make a particle trail system for the player when they enter the game, but unfortunately I have had no luck with making it. Can someone please help me make a particle trail system. It would be very helpful! (I was never really good at scripting in "Lua Script" anyway. I am still learning Info: These are ways that I tried to make a particle trail system, but they didn't work- 1)
1 | game.Workspace.Player.Torso:connect( function (t- 1 - 1 ) |
2 | local TrailTest = Instance.new( "ParticleEmitter" ) |
3 | TrailTest.Name = "TrailTest" |
4 | TrailTest.Parent = game.Workspace.Player 1. Torso |
5 | end ) |
2)
1 | game.Workspace.PlayerAdded:connect( function (plr- 1 ) |
2 | local TrailTest = Instance.new( "ParticleEmitter" ) |
3 | TrailTest.Name = "ParticleTrail" |
4 | TrailTest.Parent = game.Workspace.Player.character.Torso |
5 | end ) |
This is what you're doing wrong:
1)
Torso is not a event.
This script will only run for a Player with the name of Player
That t-1-1 might return errors, I do not see what you're trying to do there.
Scripts and objects in the game will take some time to load, so this script will return errors that Player does not exist.
2)
PlayerAdded is an event of Players, not Workspace.
'Player' in Workspace is not a Player object. It does not have a child of character, because the Player is the character object.
To fix your code:
1 | game.Players.PlayerAdded:connect( function (p) |
2 | p.CharacterAdded:connect( function (char) |
3 | local TrailTest = Instance.new( "ParticleEmitter" ) |
4 | TrailTest.Name = "TrailTest" |
5 | TrailTest.Parent = char:WaitForChild( "Torso" ) |
6 | end ) |
7 | end ) |
An easier way of doing this is to use a local script. It should be located inside a client - side service (I recommend the StarterPlayerScripts folder located in the Starter Players service. Then copy the following script:
01 | player = game.Players.LocalPlayer |
02 | if player~ = nil then |
03 | if player.Character.Humanoid.Health = = 0 then |
04 | wait( 7 ) |
05 | Particle = Instance.new( "ParticleEmitter" ) |
06 | Particle.Parent = player.Character.Torso |
07 | else |
08 | wait( 1 ) |
09 | Particle = Instance.new( "ParticleEmitter" ) |
10 | Particle.Parent = player.Character.Torso |
11 | end |
Otherwise there is one major error in your function. The PlayerAdded event is not a member of the workspace. Just switch around "Workspace with Players". First I suggest you test the script above.