I have tried multiple ways to make a particle trail system for the player when they touch the block, 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, bu t they didn't work)
1 | game.Players.PlayerAdded:connect( function (plr) |
2 | local plrName = plr.Name |
3 | plr.CharacterAdded:connect( function (char) |
4 | local plrTorso = char:WaitForChild( "Torso" ) |
5 | local sTrail = Instance.new( "ParticleEmitter" ) |
6 | sTrail.Name = "TrailTest" |
7 | sTrail.Parent = plrTorso |
8 | end ) |
9 | end ) |
Use a Touched Event...
01 | Part = script.Parent |
02 |
03 | Part.Touched:connect( function (hit) -- Use the touched event on a brick( hit refers to the part or brick that is hit by 'Part') |
04 | if hit.Parent:FindFirstChild( 'Humanoid' ) then -- If there is a humanoid it is more likely to be a player |
05 | local Player = game.Players:GetPlayerFromCharacter(hit.Parent) |
06 | if Player ~ = nil then -- checks to see if the model or Parent is actually a player |
07 | local Particles = Instance.new( 'ParticleEmitter' ) -- Creates the PartleEmitter inside of the Torso |
08 | Particles.Parent = hit.Parent.Torso |
09 | end |
10 | end |
11 | end ) |
Remember to try and do your best to make a script before asking us to make one for you, because most of the time we will not make one from scratch.
Keep that in mind...
01 | local Particles = script.Parent.ParticleEmitter --Defines the particles |
02 |
03 | script.Parent.Touched:connect( function (hit) --TouchedEvent |
04 | wait() --waits |
05 | local ParticlesClone = Particles:Clone() --Clones the particles |
06 | ParticlesClone.Parent = hit --puts the particles inside of the object that hit the part |
07 |
08 | end ) --closes the function |
09 |
10 | --]] 'hit' basically represents that part that is 'hitting' the brick. You can also change the 'hit(s)' other properties: |
11 |
12 | -- hit.Material = "Neon" |
13 | -- hit.BrickColor = BrickColor.Random() |
--Copy this code into a script located inside a part or brick.
Closed as Not Constructive by Goulstem, OldPalHappy, TheeDeathCaster, and GoldenPhysics
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?