✓ Accepted answer
try changing it to
function OnTouched(hit)
local s = Instance.new("ParticleEmitter", hit)
s.Size = NumberSequence.new(0.8)
s.LifeTime = NumberRange.new(5)
s.Texture = "http://www.roblox.com/asset/?id=7233331"
s.Transparency = NumberSequence.new(0.5)
s.EmissionDirection = "Top"
delay(5, function() s:Destroy() end))
end
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:
s.Size = NumberSequence.new(0.8, 2.8)
s.LifeTime = NumberRange.new(1,5)
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
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"
script.Parent.Touched:connect(OnTouched)
means you are commanding it: "When you are touch, do this function"
1 comment
Please explain why this answer would work, for example, you changed the Values of LifeTime and Size from an int value to Number Range and Sequence values. It's the teacher's job to teach, the student can't teach themselves