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
script.Parent.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(Tool.BodyAttach)
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = Tool.BodyAttach
idle:Play()
end)
Tool.Unequipped:Connect(function()
game.ReplicatedStorage.DisconnectM6D:FireServer()
idle:Stop()
end)
Tool.Activated:Connect(function()
if canactivate == true then
sweep:Play()
canactivate = false
wait(1)
particle = true
wait(3)
particle = false
wait(1)
sweep:Stop()
canactivate = true
end
end)
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.
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 false or true. To set the Enabled property, you need to reference the Instance like so:
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.