try changing it to
01 | function OnTouched(hit) |
03 | local s = Instance.new( "ParticleEmitter" , hit) |
04 | s.Size = NumberSequence.new( 0.8 ) |
05 | s.LifeTime = NumberRange.new( 5 ) |
07 | s.Transparency = NumberSequence.new( 0.5 ) |
08 | s.EmissionDirection = "Top" |
09 | delay( 5 , function () s:Destroy() end )) |
12 | script.Parent.Touched:connect(OnTouched) |
As you see i add "NumberSequence" and "NumberRange" in the script because Particles are not just GUIs, it is a GUI that changes itself over time. For example:
1 | s.Size = NumberSequence.new( 0.8 , 2.8 ) |
2 | s.LifeTime = NumberRange.new( 1 , 5 ) |
3 | s.Transparency = NumberSequence.new( 0.5 , 1 ) |
- means the life time of each particle is either gonna be 1 second or 2/3/4/5 seconds
- While the particle is "living" its gonna change it size from 0.8 to 2.8 over time, for example. A particle have 3 seconds lifetime, its gonna change its Size from 0.8 to 2.8 in 3 seconds.
- While the particle is "living" it will change it transparency from 0.5 to 1 in the given lifetime. Same example as above.
But in this case, if you want a certain or a constant value, you can use a single value instead of 2
Also, before you use
1 | connection = script.Parent.Touched:connect(OnTouched) |
means you set a VARIABLE for the command but you didnt command it. What you do was: "connection means: When you are touch do this function"
1 | script.Parent.Touched:connect(OnTouched) |
means you are commanding it: "When you are touch, do this function"