local module = {}
function module:RunAttackAnimation(upgrade, target)
local hum = script.Parent:WaitForChild("Humanoid")
local anim = hum:WaitForChild("Animator")
local attackAnimation = hum.Parent:WaitForChild("Animate").attack:WaitForChild("Animation")
local trk = anim:LoadAnimation(attackAnimation)
trk:Play()
local gunAttachment = script.Parent:WaitForChild("Right Arm"):WaitForChild("Glock 17 black").Barrel:WaitForChild("GunshotAttachment")
local targetAttachment = target:WaitForChild("Head"):WaitForChild("FaceCenterAttachment")
for _, child in ipairs(gunAttachment:GetChildren()) do
if child:IsA("ParticleEmitter") then
child:Emit(20) -- Emit particles (you can adjust the number as needed)
elseif child:IsA("SpotLight") then
child.Enabled = true -- Enable the spotlight
end
end
local beam = Instance.new("Beam")
beam.Attachment0 = gunAttachment
beam.Attachment1 = targetAttachment
beam.Transparency = NumberSequence.new(0.5)
beam.Width0 = 0.1
beam.Width1 = 0.1
beam.Texture = "rbxassetid://6673021984"
beam.TextureSpeed = 5
beam.Parent = gunAttachment
task.delay(0.01, function()
beam:Destroy()
for _, child in ipairs(gunAttachment:GetChildren()) do
if child:IsA("SpotLight") then
child.Enabled = false
end
end
end)
task.wait(trk.Length)
return trk.Length
end
return module
^Here's the script, the beam works but the particles wont play or appear