So I've been trying to get this attack of mine to do damage. The script creates a long cylinder as if its a "beam" and the goes through some loops to keep it centered with the characters HumanoidRootPart. I went and tried to add damage so that it would do about 5 damage every 1 second that it is touched but no damage script that I have tried has been working, this includes a damage script inside the part by itself. Could anyone help? The part of the script I want to add damage to is below:
Part in Script that creates and centers beam(I need a piece of code somewhere in here to do damage while the loops are going, I have already tried putting damage code inside the loops as well):
local Beam = game.ReplicatedStorage.Parts.Beam:Clone()
Beam.CFrame = (player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0.5, -5)) *CFrame.Angles(0, math.rad(90), 0)
Beam.Anchored = true
Beam.CanCollide = false
Beam.Parent = player.Character
game.Debris:AddItem(Beam, 4)
local increase = 0
for i = 1, 25 do
increase = increase + 2.6
Charge.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0.5, -5)
wait()
Beam.CFrame = (player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0.5, -5 - increase)) *CFrame.Angles(0, math.rad(90), 0)
Beam.Size = Beam.Size + Vector3.new(5, 0.2, 0.2)
end
for i = 1, 50 do
wait()
Charge.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0.5, -5)
Beam.CFrame = (player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0.5, -5 - increase)) *CFrame.Angles(0, math.rad(90), 0)
end

4 comments
Why not use a ray? http://wiki.roblox.com/index.php?title=Raycasting
How would your beam know it's touching a player if it's CanCollide is false? By damage code, have you tried player.Character.Humanoid:TakeDamage(5)? I know it hurts the caster.
Maybe use a coroutine? It might not help but it's worth a try.
I have tried making it do damage even to the caster and it didn't work, also, I have other attacks that work fine with the damage code and have cancollide set to false. I can't do a coroutine because it creates a new beam everytime. Also, can't use ray casting because that isn't the look that I'm going for with this attack.