As the brick touches the grass it emits particles but when it is not hitting grass the particles stop. That is my goal for this script, I have been looking through other scripts and I'm kinda confused how to do this.
So far I have this.
function onTouched(Hit) if Hit.Name == "Grass" then script.Parent.Touch.Value = true if script.Parent.Touch.Value == true then script.Parent.ParticleEmitter.Enabled = true end if script.Parent.Touch.Value == false then script.Parent.ParticleEmitter.Enabled = false end end end script.Parent.Touched:connect(onTouched)
Why don't you use else statement like this.
if script.Parent.Touch.Value == true then script.Parent.ParticleEmitter.Enabled = true else script.Parent.ParticleEmitter.Enabled = false end