The title says It all, when the tool Is unequip, It causes massive lag, however It stops when the beams despawn
Edit: Lag happens ONLY In testing
Script:
local Tool = script.Parent Tool.RemoteEvent.OnServerEvent:Connect(function() local Anim = Tool.Parent.Humanoid:FindFirstChild("Animator"):LoadAnimation(Tool.Animation) Anim:Play() wait(2.43) Tool.RandomSound:Play() local Lazer = Instance.new("Part",game.Workspace) local Lazer2 = Instance.new("Part",game.Workspace) Lazer.Position = Tool.Parent.Torso.Position Lazer.Orientation = Tool.Parent.Torso.Orientation Lazer.Size = Vector3.new(1.716, 1.741, 0.412) Lazer.CanCollide = false Lazer.Anchored = true Lazer.CastShadow = false Lazer.Material = Enum.Material.Neon Lazer2.Position = Tool.Parent.Torso.Position Lazer2.Orientation = Tool.Parent.Torso.Orientation Lazer2.Size = Vector3.new(0.578, 1.741, 1.267) Lazer2.CanCollide = false Lazer2.Anchored = true Lazer2.CastShadow = false Lazer2.Material = Enum.Material.Neon for i=0, 50 do Lazer.Size = Lazer.Size + Vector3.new(0,0,2) Lazer.BrickColor = BrickColor.random() Lazer2.Size = Lazer2.Size + Vector3.new(2,0,0) Lazer2.BrickColor = BrickColor.random() Lazer.Touched:Connect(function(hit) local Humanoid = hit.Parent:WaitForChild("Humanoid") if Humanoid ~= Tool.Parent.Humanoid then Humanoid:TakeDamage(50) Humanoid.Sit = true end end) Lazer2.Touched:Connect(function(hit) local Humanoid = hit.Parent:WaitForChild("Humanoid") if Humanoid ~= Tool.Parent.Humanoid then Humanoid:TakeDamage(50) Humanoid.Sit = true end end) wait(.01) end game:GetService("Debris"):AddItem(Lazer,0) game:GetService("Debris"):AddItem(Lazer2,0) end)