this repeats alot and isn't well optimized ( it's temporary ) and it's on a server so how would I damage
better to view source for this xd
local character = player.Character or player.CharacterAdded:Wait()
if not character then return end
local torso = FindFirstChildren(character, 'Torso', 'UpperTorso', 'HumanoidRootPart', 'Head') --// custom function, so I dont have to type a bunch of ":FindFirstChild('Torso') or"
if not torso then return end
local dir = torso.CFrame.lookVector * 3
local x0 = torso.Position + dir
for _ = 1, 5 do
local workspace = Instance_new('Model', workspace, { Name = 'Lightning' }) --// custom function (class, parent, properties)
local prmypart
for _ = 1, 5 do
local lastpos = x0
for _ = 1, 7 do
local p0, p1 = Instance_new('Part', nil, { Transparency = 1, Anchored = 1, CanCollide = false }), Instance_new('Part', nil, { Transparency = 1, Anchored = 1, CanCollide = false })
local a0, a1 = Instance.new 'Attachment', Instance.new 'Attachment'
local beam = Beam:Clone()
p0.Position = lastpos
if not prmypart then prmypart = p0 end
p1.Position = ((p0.Position + Vector3.new(0, 0, -(Random.new():NextNumber(3, 4.5)))) + Vector3.new(math.random(-3, 3), math.random(-3, 3), 0))
a0.Parent = p0
a1.Parent = p1
p0.Parent = workspace
p1.Parent = workspace
beam.Attachment1 = a1
beam.Attachment0 = a0
beam.Parent = p0
lastpos = p1.Position
end
end
workspace.PrimaryPart = prmypart
local cf = character:GetPrimaryPartCFrame()
workspace:SetPrimaryPartCFrame((cf - cf.p) + workspace.PrimaryPart.Position)
coroutine.wrap(Destroy)(workspace, .05) --// wait 0.05 to destroy
wait()
end
