I have a broom tool I’ve made, everything works fine but one problem, the particle emitter I have attached to one part of it (Bristle.Particle) will not activate when the tool.Activated goes off.
Local Script inside the tool:
local plr = game.Players.LocalPlayer
local Tool = script.Parent
local char = plr.Character or plr.CharacterAdded:Wait()
local idle = char:WaitForChild("Humanoid"):LoadAnimation(script.Idle)
local sweep = char:WaitForChild("Humanoid"):LoadAnimation(script.Sweep)
local particle = Tool.Bristle.Particle.Enabled
local canactivate = true
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = Tool.BodyAttach
if canactivate == true then
canactivate = false
particle = true
particle = false
canactivate = true
What you are saying is a little unclear, but this is what I believe you need.
I believe this is because it is in the ‘Tool.Activated’ function therefore if the tool is not activated then the code won’t run again.
What I’m trying to achieve is that the PE will temporarily enable after the player clicks. But it doesn’t seem to emit any particles at all when I’m using the tool.
If you make the particles enabled inside of studio, can you see them then?
Yes. It works outside of whenever a player is actually using it, oddly enough
Does the sweep audio play when you activate the tool?
You need to set the Enabled property of the ParticleEmitter. When you get the property like this:
local particle = Tool.Bristle.Particle.Enabled -- Same as `local particle = false`
You don’t get a reference to
Tool.Bristle.Particle.Enabled, you just get the value, which is either
true. To set the Enabled property, you need to reference the Instance like so:
local ParticleEmitter = Tool.Bristle.Particle
ParticleEmitter.Enabled = true
ParticleEmitter.Enabled = false
Notice how this code uses a reference to the ParticleEmitter Instance, and doesn’t try to get a reference to the Enabled property of the ParticleEmitter.