So i’m trying to make a spin attack but for some reason the particles dont destroy? I am using 2 scripts, 1 local script, 1 server script, and a remote event.
local script:
local Cooldown = true
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C and Cooldown == true then
Cooldown = false
local Char = game.Players.LocalPlayer.Character
local HRP = Char:FindFirstChild("HumanoidRootPart")
game.ReplicatedStorage.AttackEvent:FireServer(Char, Char:FindFirstChild("HumanoidRootPart"))
wait(10)
Cooldown = true
end
end)
server script
game.ReplicatedStorage.AttackEvent.OnServerEvent:Connect(function(Player, Char, HRP)
local Particles = Instance.new("ParticleEmitter", HRP )
Particles.Speed = NumberRange.new(0, 0)
Particles.Texture = "rbxassetid://567454904"
Particles.Rate = 10000
Particles.Lifetime = NumberRange.new(0, 1)
Particles.LockedToPart = true
Particles.LightEmission = 2
Particles.Color = ColorSequence.new(Color3.fromRGB(224, 255, 17))
for i,v in pairs(Char:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
ParticleClone = Particles:Clone()
ParticleClone.Parent = v
end
end
local Humanoid = Char:FindFirstChildWhichIsA("Humanoid")
local RotationForce = Instance.new("BodyAngularVelocity", HRP)
HRP.Touched:Connect(function(hit)
local Character = hit.Parent
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
if Humanoid then
Humanoid.Health = Humanoid.Health -10
end
if hit:IsA("Part") then
local CanDestroy = hit:GetAttribute("CanDestroy")
if CanDestroy == true then
local Health = hit:FindFirstChild("Health")
Health.Value = Health.Value -10
print(Health)
if Health.Value <= 0 then
local ExplosionEffect = Instance.new("Explosion", workspace)
ExplosionEffect.BlastPressure = 0
local Sound = Instance.new("Sound", workspace)
Sound.Volume = 4
Sound.SoundId = "rbxasset://sounds/collide.wav"
Sound:Play()
ExplosionEffect.Position = hit.Position
hit:Destroy()
end
end
end
end)
RotationForce.AngularVelocity = Vector3.new(0,25,0)
RotationForce.P = 100
RotationForce.MaxTorque = Vector3.new(10000000,10000000,10000000)
wait(5)
Particles:Destroy()
ParticleClone:Destroy()
RotationForce:Destroy()
end)