--[[function CastLightRay(startPos,endPos,color,segLength,segSpeed,parts,effectfunc)
	local part, nend = game.Workspace:FindPartOnRay( Ray.new(startPos,(endPos-startPos).unit*999.999),Tool.Parent)
	if nend then endPos = nend end
	
	if part and part.Parent then
		if part.Parent:FindFirstChild('Humanoid') and part.Parent ~=Tool.Parent then
			effectfunc(part.Parent.Humanoid,(endPos-startPos).unit)
		elseif part.Parent.Parent and part.Parent.Parent:FindFirstChild('Humanoid')  and part.Parent.Parent~=Tool.Parent then
			effectfunc(part.Parent.Parent.Humanoid,(endPos-startPos).unit)
		end
	end	
	
	
	local numSegments = math.floor(math.min((startPos-endPos).magnitude/segLength,50))
	local initNumParts = #parts
	for i=numSegments,initNumParts,1 do
		if parts[i] then
			parts[i]:Destroy()
			parts[i]=nil
		end
	end
	for i=1,numSegments,1 do
		if not parts[i] then
			parts[i] = Instance.new('Part')
			parts[i].Parent = Tool
			parts[i].Anchored = true
			parts[i].FormFactor = 'Custom'
			parts[i].Size = Vector3.new(0,0,segLength)
			parts[i].CanCollide = false
			local tlight = Instance.new('PointLight')
			tlight.Name = 'Light'
			tlight.Parent = parts[i]
			
		end
		parts[i].BrickColor = color
		parts[i]:WaitForChild('Light').Color = color.Color
		parts[i].Light.Range =((math.sin(tick()*3)+1)*1)+5
		parts[i].Light.Brightness =((math.sin(tick()*3)+1)*1)+1

		parts[i].CFrame = CFrame.new(((i-.4)*(endPos-startPos).unit*segLength)+startPos,endPos)

	end
	
	return parts
end]]