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

Wont give particles?

Asked by
22To 70
8 years ago

Well on touch its suppose to give a particle emitter, but it seems not to work, any reason why?if so can you help?

function onTouched(hit)

local s  = Instance.new("ParticleEmitter")
s.Parent = hit
s.Size = "0.8"
s.Lifetime = "5"
s.Texture = "http://www.roblox.com/asset/?id=7233331"
s.Transparency = "0.5"
s.EmissionDirection = "Top"
wait(5)
s:remove()
end

connection = script.Parent.Touched:connect(onTouched)

2 answers

Log in to vote
1
Answered by 8 years ago

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"

0
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 EzraNehemiah_TF2 3552 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

script.Parent.Touched:connect(function(hit) local Humanoid = player.Parent:FindFirstChild('Humanoid') if Humanoid then

end

:p My way...

Answer this question