I am making a new game, and I am making attacks for it, I have one where if you press the letter 'V' a bunch of brown blocks that look like dirt will appear, but, I want it to, kill people when touched, and have an animation like it spawns in a line, and it destroys itself after 5 seconds. Here is the script:
Player = game.Players.LocalPlayer
Char = Player.Character
Torso = Char.Torso
Mouse = Player:GetMouse()
function Earthkick(key)
key = key:lower()
if key == "v" then
print("EarthKick successful!")
for i = 1, 100 , 3 do
EarthBlock = Instance.new("Part")
EarthBlock.Parent = workspace
EarthBlock.Size = Vector3.new (math.random(4,6),math.random(4,6),math.random(4,6))
EarthBlock.Anchored = true
EarthBlock.TopSurface = 0
EarthBlock.BottomSurface = 0
EarthBlock.BrickColor = BrickColor.new("Brown")
EarthBlock.CFrame = CFrame.new(Torso.Position.x,5,Torso.Position.z) * CFrame.new(0,0,-i) * CFrame.Angles(math.random(),math.random(),math.random())
end
end
end
Mouse.KeyDown:connect(Earthkick)
Thanks for the help!

2 comments
Make a model with the part's properties, and the kill script is inside it, so all you neeed to do is Clone() it.
I personally hate decentralization of code, so I would actually support just having a listening event hooked up right here in the Instance creation code.