This is what i attempted to do but it enables and disables the particle emitter instantly. Trying to make it so that the particles would be enabled when i press Z and it'll disable once i press Z again.
--//Services
local UIS = game:GetService('UserInputService')
local serverStorage = game:GetService('ServerStorage')
local replicatedStorage = game:GetService('ReplicatedStorage')
--//Variables
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char:WaitForChild('Humanoid')
local root = char:WaitForChild('HumanoidRootPart')
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Z then
local clone = replicatedStorage:WaitForChild('Particle'):Clone()
clone.Parent = game.Workspace
clone.Position = root.Position
clone.ParticleEmitter.Enabled = true
local weld = Instance.new('Weld',clone)
weld.Part0 = clone
weld.Part1 = root
if clone.ParticleEmitter.Enabled == true then
if input.KeyCode == Enum.KeyCode.Z then
clone.ParticleEmitter.Enabled = false
end
end
end
end)

2 comments
try adding a wait
It's cause you set the particle emitter to true in line 17 and to false in line 25. Everytime you press Z it will always make it enabled then disabled.